diff --git a/examples/jsxstyle-preact-cli-example/package.json b/examples/jsxstyle-preact-cli-example/package.json index cf5cd312..2eaa7dc5 100644 --- a/examples/jsxstyle-preact-cli-example/package.json +++ b/examples/jsxstyle-preact-cli-example/package.json @@ -8,11 +8,11 @@ "start": "preact watch" }, "devDependencies": { - "preact-cli": "^2.1.1" + "preact-cli": "^2.2.1" }, "dependencies": { - "preact": "^8.2.7", - "preact-compat": "^3.17.0", - "preact-router": "^2.6.0" + "preact": "^8.3.1", + "preact-compat": "^3.18.4", + "preact-router": "^2.6.1" } } diff --git a/examples/jsxstyle-preact-cli-typescript-example/package.json b/examples/jsxstyle-preact-cli-typescript-example/package.json index 254689e6..b2c7e7fc 100644 --- a/examples/jsxstyle-preact-cli-typescript-example/package.json +++ b/examples/jsxstyle-preact-cli-typescript-example/package.json @@ -8,8 +8,8 @@ "start": "preact watch" }, "devDependencies": { - "preact-cli": "^2.1.1", - "ts-loader": "^4.4.1", - "typescript": "^2.9.2" + "preact-cli": "^2.2.1", + "ts-loader": "^3.5.0", + "typescript": "^3.0.3" } } diff --git a/examples/jsxstyle-react-example/package.json b/examples/jsxstyle-react-example/package.json index b86e41ff..adbe1934 100644 --- a/examples/jsxstyle-react-example/package.json +++ b/examples/jsxstyle-react-example/package.json @@ -6,20 +6,19 @@ "start": "webpack-serve" }, "devDependencies": { - "babel-core": "^6.26.0", - "babel-loader": "^7.1.4", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.6.0", - "css-loader": "^0.28.11", + "@babel/core": "^7.1.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-transform-object-assign": "^7.0.0", + "babel-loader": "^8.0.2", + "css-loader": "^1.0.0", "rimraf": "^2.6.2", - "style-loader": "^0.21.0", - "webpack": "^4.12.0", - "webpack-cli": "^3.0.8" + "style-loader": "^0.23.0", + "webpack": "^4.19.1", + "webpack-cli": "^3.1.0" }, "dependencies": { - "react": "^16.0.0", - "react-dom": "^16.0.0", - "webpack-serve": "^1.0.4" + "react": "^16.5.2", + "react-dom": "^16.5.2", + "webpack-serve": "^2.0.2" } } diff --git a/examples/jsxstyle-react-example/webpack.config.js b/examples/jsxstyle-react-example/webpack.config.js index 496c88f8..4c203bd3 100644 --- a/examples/jsxstyle-react-example/webpack.config.js +++ b/examples/jsxstyle-react-example/webpack.config.js @@ -23,7 +23,7 @@ module.exports = { babelrc: false, presets: [ [ - 'env', + '@babel/preset-env', { targets: { browsers: ['last 2 versions'], @@ -31,11 +31,11 @@ module.exports = { modules: false, }, ], - 'react', + '@babel/preset-react', ], plugins: [ - require.resolve('babel-plugin-transform-object-rest-spread'), - require.resolve('babel-plugin-transform-object-assign'), + require.resolve('@babel/plugin-proposal-object-rest-spread'), + require.resolve('@babel/plugin-transform-object-assign'), ], }, }, diff --git a/examples/jsxstyle-typescript-example/package.json b/examples/jsxstyle-typescript-example/package.json index 0de1425a..12f0b90b 100755 --- a/examples/jsxstyle-typescript-example/package.json +++ b/examples/jsxstyle-typescript-example/package.json @@ -5,23 +5,24 @@ "start": "ts-node ./node_modules/.bin/webpack-serve --config=webpack.config.ts" }, "dependencies": { - "babel-loader": "^7.1.2", - "babel-preset-env": "^1.6.0", - "css-loader": "^0.28.7", - "file-loader": "^1.1.5", - "react": "^16.0.0", - "react-dom": "^16.0.0", - "style-loader": "^0.21.0", - "ts-loader": "^4.2.0", - "typescript": "^2.9.2", - "url-loader": "^1.0.1", - "webpack": "^4.5.0", - "webpack-serve": "^1.0.4" + "@babel/core": "^7.1.0", + "@babel/preset-env": "^7.1.0", + "babel-loader": "^8.0.2", + "css-loader": "^1.0.0", + "file-loader": "^2.0.0", + "react": "^16.5.2", + "react-dom": "^16.5.2", + "style-loader": "^0.23.0", + "ts-loader": "^5.1.1", + "typescript": "^3.0.3", + "url-loader": "^1.1.1", + "webpack": "^4.19.1", + "webpack-serve": "^2.0.2" }, "devDependencies": { "@types/node": "^10.3.4", "@types/react": "^16.3.10", - "@types/react-dom": "^16.0.5", + "@types/react-dom": "^16.0.7", "@types/webpack-env": "^1.13.6" } } diff --git a/examples/jsxstyle-typescript-example/webpack.config.ts b/examples/jsxstyle-typescript-example/webpack.config.ts index 89c23ceb..adcf7b7d 100644 --- a/examples/jsxstyle-typescript-example/webpack.config.ts +++ b/examples/jsxstyle-typescript-example/webpack.config.ts @@ -35,8 +35,8 @@ const config: webpack.Configuration = { options: { babelrc: false, presets: [ - [require.resolve('babel-preset-env'), { modules: false }], - require.resolve('babel-preset-react'), + [require.resolve('@babel/preset-env'), { modules: false }], + require.resolve('@babel/preset-react'), ], }, }, diff --git a/examples/run.ts b/examples/run.ts index a3717c64..e9558233 100644 --- a/examples/run.ts +++ b/examples/run.ts @@ -1,8 +1,20 @@ +import { getPackages } from '@lerna/project'; import { spawn } from 'child_process'; -import * as fs from 'fs-extra'; import * as inquirer from 'inquirer'; import * as path from 'path'; +// NOTE: this interface is incomplete +// See: @lerna/package +interface Package { + name: string; + location: string; + private: boolean; + toJSON: () => string; +} + +const JSXSTYLE_ROOT = path.resolve(__dirname, '..'); + +// TODO: use @lerna/run const npmCommand = (example: string, ...args: string[]) => new Promise((resolve, reject) => { const childProcess = spawn('npm', args, { @@ -27,29 +39,15 @@ const npmCommand = (example: string, ...args: string[]) => }); }); -(async (command, ...args) => { - const filenames = await fs.readdir(__dirname); - const exampleDirs = filenames.filter(f => { - if (f === 'node_modules') { - return false; - } - return fs.lstatSync(path.join(__dirname, f)).isDirectory(); - }); +(async searchString => { + const packages: Package[] = await getPackages(JSXSTYLE_ROOT); + const examplePkgs = packages.filter(f => f.name.endsWith('-example')); + const choices = examplePkgs.map(pkg => ({ name: pkg.name, value: pkg.name })); - if (command === 'init') { - for (const dir of exampleDirs) { - await npmCommand(dir, '--silent', 'install'); - console.info('installed dependencies for %s', dir); - } - } else if (command === 'reset') { - for (const dir of exampleDirs) { - await fs.remove(path.join(__dirname, dir, 'node_modules')); - console.info('deleted node_modules for %s', dir); - } - } else if (!command) { + if (!searchString) { const { example } = await inquirer.prompt([ { - choices: exampleDirs.map(name => ({ name, value: name })), + choices, message: 'Pick an example', name: 'example', type: 'list', @@ -57,7 +55,11 @@ const npmCommand = (example: string, ...args: string[]) => ]); return npmCommand(example, 'start'); } else { - throw new Error('Unsupported command: ' + command); + const examplePkg = examplePkgs.find(pkg => pkg.name.includes(searchString)); + if (!examplePkg) { + throw new Error('Could not find example matching "' + searchString + '"'); + } + return npmCommand(examplePkg.name, 'start'); } }) .apply(null, process.argv.slice(2)) diff --git a/lerna.json b/lerna.json index 21e94bc1..9e015d0b 100644 --- a/lerna.json +++ b/lerna.json @@ -4,12 +4,12 @@ "packages/*" ], "version": "independent", - "commands": { + "command": { "boostrap": { "hoist": true }, "publish": { - "ignore": [ + "ignoreChanges": [ "**/*.md", "**/package.json" ], diff --git a/package.json b/package.json index 846729df..f65c6326 100644 --- a/package.json +++ b/package.json @@ -21,33 +21,33 @@ "update-readme": "echo \"$(<./misc/monorepo-preamble.md)\\n\\n---\\n\\n$(<./packages/jsxstyle/README.md)\" > README.md" }, "dependencies": { + "@babel/core": "^7.1.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-transform-object-assign": "^7.0.0", + "@babel/preset-env": "^7.1.0", + "@babel/preset-react": "^7.0.0", "@types/fs-extra": "^5.0.2", "@types/invariant": "^2.2.29", - "@types/lodash": "^4.14.109", - "@types/node": "^10.3.4", - "@types/react": "^16.3.14", - "@types/webpack": "^4.4.0", + "@types/lodash": "^4.14.116", + "@types/node": "^10.10.1", + "@types/react": "^16.4.14", + "@types/webpack": "^4.4.12", "@types/webpack-env": "^1.13.6", - "babel-core": "^6.26.0", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-preset-react": "^6.24.1", - "fs-extra": "^6.0.1", + "fs-extra": "^7.0.0", "inquirer": "^6.0.0", - "lerna": "^2.11.0", + "lerna": "^3.4.0", "preact": "^8.2.6", "prettier": "^1.12.0", "react": "^16.0.0", "react-dom": "^16.0.0", "rimraf": "^2.6.2", - "rollup": "^0.61.0", - "rollup-plugin-typescript2": "^0.15.0", - "ts-node": "^7.0.0", - "tslint": "^5.9.1", - "tslint-config-prettier": "^1.12.0", + "rollup": "^0.66.1", + "rollup-plugin-typescript2": "^0.17.0", + "ts-node": "^7.0.1", + "tslint": "^5.11.0", + "tslint-config-prettier": "^1.15.0", "tslint-react": "^3.6.0", - "typescript": "^2.9.2" + "typescript": "^3.0.3" }, "prettier": { "singleQuote": true, diff --git a/packages/jsxstyle-utils/package.json b/packages/jsxstyle-utils/package.json index 8729d4c7..baff6449 100644 --- a/packages/jsxstyle-utils/package.json +++ b/packages/jsxstyle-utils/package.json @@ -12,6 +12,6 @@ "jsxstyle" ], "dependencies": { - "csstype": "^2.2.0" + "csstype": "^2.5.7" } } diff --git a/packages/jsxstyle-webpack-plugin/package.json b/packages/jsxstyle-webpack-plugin/package.json index c30b1e70..6cd6b39e 100644 --- a/packages/jsxstyle-webpack-plugin/package.json +++ b/packages/jsxstyle-webpack-plugin/package.json @@ -15,16 +15,16 @@ "@babel/traverse": "^7.1.0", "@babel/types": "^7.0.0", "@types/loader-utils": "^1.1.3", - "@types/node": "^10.3.4", - "@types/webpack": "^4.4.0", - "ajv": "^6.5.0", + "@types/node": "^10.10.1", + "@types/webpack": "^4.4.12", + "ajv": "^6.5.3", "invariant": "^2.2.1", "jsxstyle": "^2.1.3", "jsxstyle-utils": "^2.1.3", "loader-utils": "^1.1.0" }, "devDependencies": { - "webpack": ">=2 <5" + "webpack": "^4.19.1" }, "peerDependencies": { "webpack": ">=2 <5" diff --git a/tests/jsxstyle-webpack-plugin/webpack/webpack.config.ts b/tests/jsxstyle-webpack-plugin/webpack/webpack.config.ts index 5c0b5852..1c226fb6 100644 --- a/tests/jsxstyle-webpack-plugin/webpack/webpack.config.ts +++ b/tests/jsxstyle-webpack-plugin/webpack/webpack.config.ts @@ -40,8 +40,8 @@ config.module = { options: { babelrc: false, presets: [ - [require.resolve('babel-preset-env'), { modules: false }], - require.resolve('babel-preset-react'), + [require.resolve('@babel/preset-env'), { modules: false }], + require.resolve('@babel/preset-react'), ], }, }, diff --git a/tests/karma.conf.ts b/tests/karma.conf.ts index e3db17b3..029e317c 100644 --- a/tests/karma.conf.ts +++ b/tests/karma.conf.ts @@ -79,17 +79,17 @@ export default (config: KarmaConfig) => { babelrc: false, presets: [ [ - 'env', + '@babel/preset-env', { modules: false, targets: { browsers: ['last 2 versions'] }, }, ], - 'react', + '@babel/preset-react', ], plugins: [ - 'transform-object-rest-spread', - 'transform-object-assign', + '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-transform-object-assign', ], }, }, diff --git a/tests/meta.spec.ts b/tests/meta.spec.ts index bc355278..e514785c 100644 --- a/tests/meta.spec.ts +++ b/tests/meta.spec.ts @@ -1,43 +1,36 @@ -import * as PackageUtilities from 'lerna/lib/PackageUtilities'; -import * as Repository from 'lerna/lib/Repository'; -import * as packlist from 'npm-packlist'; +import { getPackages } from '@lerna/project'; +import packlist from 'npm-packlist'; import * as path from 'path'; -import { Dict } from '../packages/jsxstyle-utils'; +// NOTE: this interface is incomplete +// See: @lerna/package interface Package { - /** parsed contents of the package's package.json file */ - _package: { - name: string; - private?: true; - version?: string; - main?: string; - scripts?: Dict; - devDependencies?: Dict; - dependencies?: Dict; - }; - /** absolute path to the package */ - _location: string; + name: string; + location: string; + private: boolean; + toJSON: () => string; } -// get all packages from Lerna const JSXSTYLE_ROOT = path.resolve(__dirname, '..'); -const repo = new Repository(JSXSTYLE_ROOT); -const packages: Package[] = PackageUtilities.getPackages(repo); -packages.sort((a, b) => a._package.name.localeCompare(b._package.name)); describe('npm publish', () => { it('only publishes the intended files', async () => { - const pkgPromises = Promise.all( - packages.map(async pkg => { - const fileList = await packlist({ path: pkg._location }); - return ` -${pkg._package.name} -${pkg._package.name.replace(/./g, '=')} + const packages: Package[] = await getPackages(JSXSTYLE_ROOT); + const packagePromises = packages + // exclude private packages + .filter(pkg => !pkg.private) + .sort((a, b) => a.name.localeCompare(b.name)) + .map(pkg => + // fetch file list and format it into something + packlist({ path: pkg.location }).then( + fileList => ` +${pkg.name} +${pkg.name.replace(/./g, '=')} ${fileList.map(f => `- ${f}`).join('\n')} -`; - }) - ); +` + ) + ); - await expect(pkgPromises).resolves.toMatchSnapshot(); + await expect(Promise.all(packagePromises)).resolves.toMatchSnapshot(); }); }); diff --git a/tests/package.json b/tests/package.json index 3ba59095..cd800d18 100644 --- a/tests/package.json +++ b/tests/package.json @@ -9,12 +9,14 @@ "update-sauce-data": "curl https://saucelabs.com/rest/v1/info/platforms/appium > saucelabs-data.json" }, "dependencies": { + "@babel/core": "^7.1.0", "@babel/generator": "^7.0.0", "@babel/traverse": "^7.1.0", - "@types/jest": "^23.1.1", + "@types/jest": "^23.3.2", "@types/karma": "^1.7.3", "@types/node": "^10.3.5", - "babel-loader": "^7.1.2", + "babel-core": "^7.0.0-bridge.0", + "babel-loader": "^8.0.2", "core-js": "^2.5.1", "css-loader": "^0.28.9", "dotenv": "^6.0.0", @@ -32,7 +34,7 @@ "rollup-plugin-node-resolve": "^3.0.2", "rollup-plugin-replace": "^2.0.0", "rollup-plugin-uglify": "^4.0.0", - "ts-jest": "^22.4.6", + "ts-jest": "^23.10.0", "ts-loader": "^4.2.0", "webpack": "^4.8.3" }, diff --git a/tsconfig.json b/tsconfig.json index 9aeebbec..5ea90b91 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "allowJs": false, "declaration": true, + "declarationMap": true, "forceConsistentCasingInFileNames": true, "lib": ["es6"], "module": "commonjs",