diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f93d56cd..d560912fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,21 +39,12 @@ git clone --depth 100 git@github.com:betagouv/mon-entreprise.git && cd mon-entre # Install the Javascript dependencies through Yarn yarn install -# Run the server for mon-entreprise -cd mon-entreprise +# Watch changes in publicodes and run the server for mon-entreprise yarn start ``` L'application est exécuté sur https://localhost:8080/mon-entreprise pour la version française et http://localhost:8080/infrance pour la version anglaise. -Si vous souhaitez travailler sur le package publicode, on peut créer un lien -symbolique depuis mon-entreprise en executant la commande suivante à la racine -du projet : - -``` -yarn run link:publicodes -``` - ### Messages de commit A mettre sans retenue dans les messages de commit : @@ -141,7 +132,7 @@ N'oubliez pas de vérifier sur le diff que rien n'est choquant. ### Analyse des bundles -La commande `yarn run compile:analyse-bundle` gènere une visualisation interactive du +La commande `yarn run build:analyse-bundle` gènere une visualisation interactive du contenu packagé, cf. [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) diff --git a/circle.yml b/circle.yml index b6a70b9e8..3d9931d83 100644 --- a/circle.yml +++ b/circle.yml @@ -74,7 +74,7 @@ jobs: resource_class: medium+ steps: - install - - run: yarn workspace mon-entreprise compile:dev + - run: yarn workspace mon-entreprise build:dev - run: command: yarn workspace mon-entreprise serve:dev background: true diff --git a/mon-entreprise/package.json b/mon-entreprise/package.json index 389956c21..f605435cc 100644 --- a/mon-entreprise/package.json +++ b/mon-entreprise/package.json @@ -20,7 +20,7 @@ "html-webpack-plugin": "^3.2.0", "i18next-parser": "^1.0.6", "monaco-editor-webpack-plugin": "^1.9.0", - "workbox-webpack-plugin": "^5.1.3", + "workbox-webpack-plugin": "^3.6.0", "worker-loader": "^2.0.0" }, "dependencies": { @@ -36,7 +36,7 @@ "js-yaml": "^3.13.1", "moo": "^0.5.0", "nearley": "^2.19.0", - "publicodes": "^1.0.0", + "publicodes": "^1.0.0-beta.1", "ramda": "^0.27.0", "react": "^16.13.1", "react-color": "^2.14.0", @@ -69,12 +69,13 @@ }, "scripts": { "prepare": "node scripts/prepare.js", - "compile": "yarn run compile:prod && yarn run compile:legacy", - "compile:prod": "yarn run webpack --config webpack.prod.js", - "compile:legacy": "yarn run webpack --config webpack.prod.legacyBrowser.js", - "compile:stats": "webpack --config webpack.prod.js --profile --json > stats.json", - "compile:analyze-bundle": "ANALYZE_BUNDLE=1 yarn run compile", - "compile:dev": "FR_SITE='http://localhost:5000${path}' EN_SITE='http://localhost:5001${path}' yarn run compile", + "build": "yarn run build:prod && yarn run build:legacy", + "build:prod": "yarn run webpack --config webpack.prod.js", + "build:legacy": "yarn run webpack --config webpack.prod.legacyBrowser.js", + "build:stats": "webpack --config webpack.prod.js --profile --json > stats.json", + "build:analyze-bundle": "ANALYZE_BUNDLE=1 yarn run build", + "build:dev": "FR_SITE='http://localhost:5000${path}' EN_SITE='http://localhost:5001${path}' yarn run build", + "clean": "rimraf dist node_modules source/data", "test": "yarn test:file \"./{,!(node_modules)/**/}!(webpack).test.js\"", "test:file": "yarn mocha-webpack --webpack-config ./webpack.dev.js --include test/componentTestSetup.js --require mock-local-storage --require test/helpers/browser.js", "test:bundlesize": "bundlesize", @@ -89,6 +90,7 @@ "serve:dev": "yarn run serve:dev:mon-entreprise & yarn run serve:dev:mycompanyinfrance & yarn run serve:dev:publicodes", "serve:dev:mon-entreprise": "PORT=5000 serve --config serve.mon-entreprise.json --no-clipboard", "serve:dev:publicodes": "PORT=5002 serve --config serve.publicodes.json --no-clipboard", - "serve:dev:mycompanyinfrance": "PORT=5001 serve --config serve.infrance.json --no-clipboard" + "serve:dev:mycompanyinfrance": "PORT=5001 serve --config serve.infrance.json --no-clipboard", + "publish:publicodes": "yarn run lint && yarn run " } } diff --git a/mon-entreprise/webpack.dev.js b/mon-entreprise/webpack.dev.js index 67e295c2e..19f0e5f8f 100644 --- a/mon-entreprise/webpack.dev.js +++ b/mon-entreprise/webpack.dev.js @@ -3,7 +3,7 @@ const { map } = require('ramda') const webpack = require('webpack') const { commonLoaders, styleLoader } = require('../webpack/common') -const { HTMLPlugins, default: common } = require('./webpack.common.js') +const { HTMLPlugins, default: common } = require('./webpack.common') module.exports = { ...common, diff --git a/mon-entreprise/webpack.prod.js b/mon-entreprise/webpack.prod.js index 56df79a9e..8fe94f61b 100644 --- a/mon-entreprise/webpack.prod.js +++ b/mon-entreprise/webpack.prod.js @@ -1,7 +1,7 @@ /* eslint-env node */ -const { HTMLPlugins, default: common } = require('./webpack.common.js') -const { commonLoaders, styleLoader } = require('../webpack/common.js') +const { HTMLPlugins, default: common } = require('./webpack.common') +const { commonLoaders, styleLoader } = require('../webpack/common') const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') diff --git a/mon-entreprise/webpack.prod.legacyBrowser.js b/mon-entreprise/webpack.prod.legacyBrowser.js index 1f8d4a60b..fb28d0884 100644 --- a/mon-entreprise/webpack.prod.legacyBrowser.js +++ b/mon-entreprise/webpack.prod.legacyBrowser.js @@ -1,12 +1,9 @@ const { map } = require('ramda') const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin') -const prod = require('./webpack.prod.js') -const { - commonLoaders, - styleLoader, - HTMLPlugins -} = require('./webpack.common.js') +const prod = require('./webpack.prod') +const { HTMLPlugins } = require('./webpack.common') +const { commonLoaders, styleLoader } = require('../webpack/common') const { EnvironmentPlugin } = require('webpack') @@ -14,8 +11,7 @@ module.exports = { ...prod, entry: map(entry => ['whatwg-fetch', entry], prod.entry), output: { - filename: '[name].legacy.bundle.js', - ecmaVersion: 5 + filename: '[name].legacy.bundle.js' }, module: { rules: [...commonLoaders({ legacy: true }), styleLoader('style-loader')] diff --git a/netlify.toml b/netlify.toml index 3713c656e..b42a737eb 100644 --- a/netlify.toml +++ b/netlify.toml @@ -245,7 +245,7 @@ [build] # Hack while waiting for netlify to support workspace # https://github.com/netlify/build-image/issues/196 - command = "npm i yarn && yarn && yarn workspace mon-entreprise compile" + command = "npm i yarn && yarn && yarn workspaces run prepare && yarn workspace mon-entreprise build" publish = "mon-entreprise/dist" [context.deploy-preview.environment] diff --git a/package.json b/package.json index 1c7a48c61..b02d9563a 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "prettier": "^1.19.1", "raw-loader": "^0.5.1", "react-hot-loader": "^4.12.15", + "rimraf": "^3.0.2", "serve": "^11.1.0", "sinon": "^4.5.0", "sinon-chai": "^3.0.0", @@ -110,13 +111,13 @@ "lint:prettier": "yarn workspaces run prettier --check \"{source,test,cypress}/**/*.{js,jsx,ts,tsx}\"", "lint:prettier:fix": "yarn lint:prettier --write", "lint:fix": "yarn lint:eslint:fix && yarn lint:prettier:fix", + "prepare": "if [ -z \"$NETLIFY\" ]; then yarn workspaces run prepare; fi", "lint": "yarn lint:eslintrc && yarn lint:eslint && yarn lint:prettier", "test": "yarn workspaces run test", - "prepare": "yarn link:publicodes && yarn workspaces run prepare", "test:type": "yarn workspaces run tsc", "test:regressions": "jest", - "link:publicodes": "yarn workspace publicodes link && yarn workspace mon-entreprise link publicodes", - "start": "yarn workspace publicodes compile --watch & yarn workspace mon-entreprise start" + "clean": "yarn workspaces run clean", + "start": "yarn workspace publicodes build --watch & yarn workspace mon-entreprise start" }, "workspaces": [ "mon-entreprise", diff --git a/publicodes/package.json b/publicodes/package.json index 26a7882df..50a0c4506 100644 --- a/publicodes/package.json +++ b/publicodes/package.json @@ -1,6 +1,6 @@ { "name": "publicodes", - "version": "1.0.0", + "version": "1.0.0-beta.1", "description": "A declarative language for encoding public algorithm", "main": "dist/index.js", "types": "dist/types/index.d.ts", @@ -34,8 +34,10 @@ "react-router-hash-link": "^1.2.2" }, "scripts": { - "prepare": "tsc && yarn run compile", - "compile": "yarn run webpack --config webpack.config.js", + "prepublishOnly": "yarn test && yarn run build", + "clean": "rimraf dist node_modules", + "prepare": "yarn run clean && yarn run build", + "build": "tsc && yarn run webpack --config webpack.config.js", "test:file": "yarn mocha-webpack --webpack-config ./webpack.test.js --include test/setupIntl.js", "test": "yarn test:file \"./{,!(node_modules)/**/}!(webpack).test.js\"" }, diff --git a/yarn.lock b/yarn.lock index 4ef247704..feb275627 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10223,6 +10223,13 @@ rimraf@^2.3.4, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: dependencies: glob "^7.1.3" +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c"