Skip to content

Commit 663bd95

Browse files
Moving from ES6 to TypeScript and Snowpack to Vite
1 parent 292d240 commit 663bd95

16 files changed

+1729
-2321
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
2+
"presets": [
3+
"@babel/env",
4+
"@babel/preset-typescript"
5+
],
26
"plugins": [
7+
"@babel/plugin-transform-typescript",
38
"@babel/plugin-proposal-class-properties"
49
]
510
}

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pkg
1+
dist

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules
2-
pkg
2+
dist
33
build

.npmignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ jest
33
.babelrc
44
jest.config.js
55
index.html
6-
snowpack.config.json
76
netlify.toml
87
.node-version
98
.eslintrc.js
109
src
10+
spec
11+
tsconfig.json
12+
vite.config.js
13+
.prettierignore

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<script type="module" defer>
1515
import { Application } from 'stimulus'
16-
import NestedForm from './src/index.js'
16+
import NestedForm from './src/index'
1717

1818
const application = Application.start()
1919
application.register('nested-form', NestedForm)

jest.config.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

jest/jest-setup.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
const { setup: setupDevServer } = require('jest-dev-server')
2-
const { setup: setupPuppeteer } = require('jest-environment-puppeteer')
3-
4-
module.exports = async function globalSetup (globalConfig) {
5-
await setupPuppeteer(globalConfig)
6-
await setupDevServer({
7-
command: `yarn dev --open none --port 3000`,
8-
launchTimeout: 50000,
9-
port: 3000
10-
})
11-
}
1+
import '@babel/polyfill'
2+
import 'mutationobserver-shim'

jest/jest-teardown.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,42 @@
77
"license": "MIT",
88
"homepage": "https://github.com/stimulus-components/stimulus-rails-nested-form",
99
"private": false,
10-
"esnext": "dist-src/index.js",
11-
"main": "dist-node/index.js",
12-
"module": "dist-web/index.js",
13-
"@pika/pack": {
14-
"pipeline": [
15-
[
16-
"@pika/plugin-standard-pkg"
17-
],
18-
[
19-
"@pika/plugin-build-web"
20-
],
21-
[
22-
"@pika/plugin-build-node"
23-
]
24-
]
25-
},
10+
"main": "dist/stimulus-rails-nested-form.umd.js",
11+
"module": "dist/stimulus-rails-nested-form.es.js",
2612
"scripts": {
27-
"format": "prettier-standard '**/*.{js,css,html}' --format",
28-
"lint": "prettier-standard '**/*.{js,css,html}' --lint",
29-
"dev": "snowpack dev",
30-
"prod": "snowpack build",
31-
"build": "pika build",
13+
"format": "prettier-standard '**/*.{ts,css,html}' --format",
14+
"lint": "prettier-standard '**/*.{ts,css,html}' --lint",
15+
"dev": "vite",
16+
"prod": "vite build --config /dev/null",
17+
"build": "tsc --noEmit && vite build",
18+
"version": "yarn build",
3219
"test": "BABEL_ENV=test jest",
33-
"pika:publish": "pika publish --no-2fa",
34-
"version": "yarn build"
35-
},
36-
"dependencies": {
37-
"stimulus": "^2.0.0"
20+
"np": "np --no-2fa"
3821
},
3922
"devDependencies": {
4023
"@babel/core": "7.11.6",
4124
"@babel/plugin-syntax-class-properties": "7.10.4",
42-
"@babel/preset-env": "7.11.5",
43-
"@pika/pack": "0.5.0",
44-
"@pika/plugin-build-node": "0.9.2",
45-
"@pika/plugin-build-web": "0.9.2",
46-
"@pika/plugin-standard-pkg": "0.9.2",
25+
"@babel/polyfill": "^7.12.1",
26+
"@babel/preset-env": "^7.14.1",
27+
"@babel/preset-typescript": "^7.13.0",
4728
"@snowpack/plugin-babel": "2.1.3",
29+
"@testing-library/dom": "^7.30.4",
4830
"@types/jest": "^26.0.14",
4931
"babel-jest": "^26.5.2",
5032
"jest": "^26.5.3",
51-
"jest-dev-server": "^4.4.0",
52-
"jest-puppeteer": "^4.4.0",
33+
"mutationobserver-shim": "^0.3.7",
34+
"np": "^7.5.0",
5335
"prettier-standard": "16.4.1",
54-
"puppeteer": "^5.3.1",
55-
"snowpack": "2.14.0"
36+
"stimulus": "^2.0.0",
37+
"typescript": "^4.2.4",
38+
"vite": "^2.2.4"
39+
},
40+
"jest": {
41+
"setupFiles": [
42+
"<rootDir>/jest/jest-setup.js"
43+
]
44+
},
45+
"peerDependencies": {
46+
"stimulus": "^2.0.0"
5647
}
5748
}

snowpack.config.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)