diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000000000000000000000000000000000..348076b955bb3bb1fe6b3404f0fc517a271fd975 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +10.15.3 diff --git a/.semaphore/branch-guard.sh b/.semaphore/branch-guard.sh new file mode 100644 index 0000000000000000000000000000000000000000..e657b3069e31040dd083ec4db8910cee6b2a42c1 --- /dev/null +++ b/.semaphore/branch-guard.sh @@ -0,0 +1,8 @@ +if [ "$SEMAPHORE_GIT_BRANCH" = $1 ]; +then + echo "Branch matches $1" + exit 0; +else + echo "Branch $SEMAPHORE_GIT_BRANCH does not match $1" + exit 1 +fi diff --git a/.semaphore/release.yml b/.semaphore/release.yml new file mode 100644 index 0000000000000000000000000000000000000000..2cb6ed68b916cd315bf16f124d5ab059e538e293 --- /dev/null +++ b/.semaphore/release.yml @@ -0,0 +1,49 @@ +# Use the latest stable version of Semaphore 2.0 YML syntax: +version: v1.0 + +# Name your pipeline. In case you connect multiple pipelines with promotions, +# the name will help you differentiate between, for example, a CI build phase +# and delivery phases. +name: Master Branch Release Flow + +# An agent defines the environment in which your code runs. +# It is a combination of one of available machine types and operating +# system images. +# See https://docs.semaphoreci.com/article/20-machine-types +# and https://docs.semaphoreci.com/article/32-ubuntu-1804-image +agent: + machine: + type: e1-standard-2 + os_image: ubuntu1804 + +# Blocks are the heart of a pipeline and are executed sequentially. +# Each block has a task that defines one or more jobs. Jobs define the +# commands to execute. +# See https://docs.semaphoreci.com/article/62-concepts +blocks: + - name: Release + task: + secrets: + - name: create-react-app-aws-credentials + - name: git-user + prologue: + commands: + # Correct premissions since they are too open by default: + - checkout + - sh .semaphore/branch-guard.sh master + - cd packages/react-scripts + - cache restore node-cache-$SEMAPHORE_GIT_BRANCH-$SEMAPHORE_WORKFLOW_ID + - eval "$(node ./node_modules/.bin/as-aws-get-params --with-decryption)" + - ssh-add - <<< "${GIT_SSH_DEPLOY_KEY}" + - echo "//npm.fury.io/amplifiedai/:_authToken=$NPM_WRITE_TOKEN" >> .npmrc + - nvm use + - node --version + - yarn --version + jobs: + - name: Tag and Release + commands: + - git config user.name $GIT_ACCESS_USER + - git config user.email $GIT_ACCESS_EMAIL + - "yarn release --message \"chore(release): %s [ci skip]\"" # flag will change to releaseCommitMessageFormat https://github.com/conventional-changelog/standard-version/commit/a7133cc0e5a1924793bdf0e4abdd0ad9c58dfc2d#diff-168726dbe96b3ce427e7fedce31bb0bcR21 + - git push --follow-tags origin $SEMAPHORE_GIT_BRANCH + - npm publish diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml new file mode 100644 index 0000000000000000000000000000000000000000..72cffca9a96dbfca4169fa8221eb256bb22e0194 --- /dev/null +++ b/.semaphore/semaphore.yml @@ -0,0 +1,72 @@ +# Use the latest stable version of Semaphore 2.0 YML syntax: +version: v1.0 + +# Name your pipeline. In case you connect multiple pipelines with promotions, +# the name will help you differentiate between, for example, a CI build phase +# and delivery phases. +name: Semaphore JavaScript Example Pipeline + +# An agent defines the environment in which your code runs. +# It is a combination of one of available machine types and operating +# system images. +# See https://docs.semaphoreci.com/article/20-machine-types +# and https://docs.semaphoreci.com/article/32-ubuntu-1804-image +agent: + machine: + type: e1-standard-2 + os_image: ubuntu1804 + +# Blocks are the heart of a pipeline and are executed sequentially. +# Each block has a task that defines one or more jobs. Jobs define the +# commands to execute. +# See https://docs.semaphoreci.com/article/62-concepts +blocks: + - name: Install dependencies + task: + # Set environment variables that your project requires. + # See https://docs.semaphoreci.com/article/66-environment-variables-and-secrets + env_vars: + - name: NODE_ENV + value: test + - name: CI + value: 'true' + secrets: + - name: gemfury-read-token + # This block runs two jobs in parallel and they both share common + # setup steps. We can group them in a prologue. + # See https://docs.semaphoreci.com/article/50-pipeline-yaml#prologue + prologue: + commands: + # Get the latest version of our source code from GitHub: + - checkout + # Use the version of Node.js specified in .nvmrc. + # Semaphore provides nvm preinstalled. + - nvm use + - node --version + - yarn --version + - cd packages/react-scripts + jobs: + # First parallel job: + - name: yarn install and cache + commands: + # Restore dependencies from cache. This command will not fail in + # case of a cache miss. In case of a cache hit, yarn install will + # run very fast. + # For more info on caching, see https://docs.semaphoreci.com/article/68-caching-dependencies + - cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$SEMAPHORE_WORKFLOW_ID,yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop,yarn-cache-master + - echo "yarn-offline-mirror \"./.yarn-cache\"" >> .yarnrc + - echo "//npm.fury.io/amplifiedai/:_authToken=$NPM_TOKEN" >> .npmrc + - yarn install + + # Store the latest version of node modules in cache to reuse in + # further blocks: + - cache store yarn-cache-$SEMAPHORE_GIT_BRANCH-$SEMAPHORE_WORKFLOW_ID .yarn-cache + - cache store node-cache-$SEMAPHORE_GIT_BRANCH-$SEMAPHORE_WORKFLOW_ID node_modules + +promotions: + - name: Master Release + pipeline_file: release.yml + auto_promote_on: + - result: passed + branch: + - ^master$ diff --git a/packages/react-scripts/.npmrc b/packages/react-scripts/.npmrc new file mode 100644 index 0000000000000000000000000000000000000000..6c4c069b1e9e1c392db2ce4cbcd25d97309a74d5 --- /dev/null +++ b/packages/react-scripts/.npmrc @@ -0,0 +1 @@ +@amplified:registry=https://npm.fury.io/amplifiedai/ diff --git a/packages/react-scripts/CHANGELOG.md b/packages/react-scripts/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..2e3bf3a89faa1a653626a1af6ebfab74048e7751 --- /dev/null +++ b/packages/react-scripts/CHANGELOG.md @@ -0,0 +1,148 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## 0.2.0 (2019-05-30) + +### Features + +- skip tagging so that there aren't version tag clashes with upstream ([4a92f9e](https://github.com/amplifiedai/create-react-app/commit/4a92f9e)) +- update path for output to \_assets as per fab spec ([c50a69e](https://github.com/amplifiedai/create-react-app/commit/c50a69e)) +- update references to push to gemfury ([28abddc](https://github.com/amplifiedai/create-react-app/commit/28abddc)) + +### 3.0.1 (2019-05-08) + +## 3.0.0 (2019-04-22) + +### Bug Fixes + +- terser-webpack-plugin hanging on WSL ([#6732](https://github.com/amplifiedai/create-react-app/issues/6732)) ([3e336d9](https://github.com/amplifiedai/create-react-app/commit/3e336d9)) + +### 2.1.8 (2019-03-07) + +### 2.1.7 (2019-03-07) + +### 2.1.6 (2019-03-06) + +### 2.1.5 (2019-02-11) + +### 2.1.4 (2019-02-10) + +### 2.1.3 (2019-01-04) + +### 2.1.2 (2018-12-23) + +### Bug Fixes + +- add `sideEffects: false` to react-error-overlay ([#5451](https://github.com/amplifiedai/create-react-app/issues/5451)) ([2c92fd4](https://github.com/amplifiedai/create-react-app/commit/2c92fd4)) +- make typescriptformatter support 0.5 of fork checker ([#5879](https://github.com/amplifiedai/create-react-app/issues/5879)) ([3a14e8f](https://github.com/amplifiedai/create-react-app/commit/3a14e8f)) + +### 2.1.1 (2018-11-01) + +### Bug Fixes + +- Duplicate string index signature in ProcessEnv ([#5621](https://github.com/amplifiedai/create-react-app/issues/5621)) ([e1321e5](https://github.com/amplifiedai/create-react-app/commit/e1321e5)) + +## 2.1.0 (2018-10-30) + +### 2.0.5 (2018-10-14) + +### 2.0.4 (2018-10-03) + +### 2.0.3 (2018-10-02) + +### 1.1.5 (2018-08-24) + +### 1.1.4 (2018-04-04) + +### 1.1.3 (2018-04-03) + +### 1.1.2 (2018-04-02) + +### 1.1.1 (2018-02-09) + +### Features + +- add opt-out for prestet-flow to work with @babel/preset-typescript ([#3865](https://github.com/amplifiedai/create-react-app/issues/3865)) ([d67a9e7](https://github.com/amplifiedai/create-react-app/commit/d67a9e7)) + +## 1.1.0 (2018-01-15) + +### 1.0.17 (2017-11-03) + +### 1.0.16 (2017-10-31) + +### 1.0.13 (2017-09-02) + +### 1.0.12 (2017-08-28) + +### 1.0.11 (2017-08-09) + +### 1.0.10 (2017-06-29) + +### 1.0.9 (2017-06-29) + +### 1.0.8 (2017-06-28) + +### 1.0.7 (2017-05-27) + +### 1.0.6 (2017-05-24) + +### 1.0.5 (2017-05-22) + +### 1.0.4 (2017-05-22) + +### 1.0.3 (2017-05-21) + +### 1.0.2 (2017-05-20) + +### 1.0.1 (2017-05-19) + +## 1.0.0 (2017-05-19) + +### 0.9.2 (2017-02-26) + +## 0.9.0 (2017-02-11) + +### Bug Fixes + +- add yarn gitignores ([#1507](https://github.com/amplifiedai/create-react-app/issues/1507)) ([b0b0e6d](https://github.com/amplifiedai/create-react-app/commit/b0b0e6d)) + +### 0.8.5 (2017-01-09) + +### 0.8.4 (2016-12-11) + +### 0.8.3 (2016-12-08) + +### 0.8.2 (2016-12-07) + +### 0.8.1 (2016-12-04) + +## 0.8.0 (2016-12-03) + +## 0.7.0 (2016-10-22) + +### 0.6.1 (2016-09-27) + +## 0.6.0 (2016-09-25) + +### 0.5.1 (2016-09-23) + +## 0.5.0 (2016-09-23) + +### 0.4.3 (2016-09-18) + +### 0.4.2 (2016-09-18) + +### 0.4.1 (2016-09-03) + +## 0.4.0 (2016-09-02) + +### 0.3.1 (2016-09-02) + +## 0.3.0 (2016-09-01) + +### 0.2.1 (2016-08-01) + +## 0.2.0 (2016-07-28) + +## 0.1.0 (2016-07-22) diff --git a/packages/react-scripts/config/aws-params.js b/packages/react-scripts/config/aws-params.js new file mode 100644 index 0000000000000000000000000000000000000000..e9f8b2eda8d579caaa6a80fa2ff1114d2c47602f --- /dev/null +++ b/packages/react-scripts/config/aws-params.js @@ -0,0 +1,8 @@ +'use strict'; + +const awsParams = { + GIT_SSH_DEPLOY_KEY: '/repo/create-react-app/GIT_SSH_DEPLOY_KEY', + NPM_WRITE_TOKEN: '/env/global/gemfury/NPM_WRITE_TOKEN', +}; + +module.exports = awsParams; diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 8f70442d584e6c3f48205fd3c750a43b5b5ac752..89a556ccf60aeec17c5ae9de06fc4a729c7680f8 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -165,14 +165,14 @@ module.exports = function(webpackEnv) { // There will be one main bundle, and one file per asynchronous chunk. // In development, it does not produce real files. filename: isEnvProduction - ? 'static/js/[name].[contenthash:8].js' - : isEnvDevelopment && 'static/js/bundle.js', + ? '_assets/js/[name].[contenthash:8].js' + : isEnvDevelopment && '_assets/js/bundle.js', // TODO: remove this when upgrading to webpack 5 futureEmitAssets: true, // There are also additional JS chunk files if you use code splitting. chunkFilename: isEnvProduction - ? 'static/js/[name].[contenthash:8].chunk.js' - : isEnvDevelopment && 'static/js/[name].chunk.js', + ? '_assets/js/[name].[contenthash:8].chunk.js' + : isEnvDevelopment && '_assets/js/[name].chunk.js', // We inferred the "public path" (such as / or /my-project) from homepage. // We use "/" in development. publicPath: publicPath, @@ -344,7 +344,7 @@ module.exports = function(webpackEnv) { loader: require.resolve('url-loader'), options: { limit: 10000, - name: 'static/media/[name].[hash:8].[ext]', + name: '_assets/media/[name].[hash:8].[ext]', }, }, // Process application JS with Babel. @@ -513,7 +513,7 @@ module.exports = function(webpackEnv) { // by webpacks internal loaders. exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], options: { - name: 'static/media/[name].[hash:8].[ext]', + name: '_assets/media/[name].[hash:8].[ext]', }, }, // ** STOP ** Are you adding a new loader? @@ -586,8 +586,8 @@ module.exports = function(webpackEnv) { new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional - filename: 'static/css/[name].[contenthash:8].css', - chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', + filename: '_assets/css/[name].[contenthash:8].css', + chunkFilename: '_assets/css/[name].[contenthash:8].chunk.css', }), // Generate a manifest file which contains a mapping of all asset filenames // to their corresponding output file so that tools can pick it up without diff --git a/packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js b/packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js index 5f1b7df1edaedd47c3adc62fc27495a16cf4cb9e..432fa36fb396383782e94453359fc861f5d336e6 100644 --- a/packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js +++ b/packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js @@ -94,7 +94,7 @@ describe('Integration', () => { doc = await initDOM('no-ext-inclusion'); expect(doc.getElementById('feature-no-ext-inclusion').href).toMatch( - /\/static\/media\/aFileWithoutExt\.[a-f0-9]{8}\.bin$/ + /\/_assets\/media\/aFileWithoutExt\.[a-f0-9]{8}\.bin$/ ); }); @@ -117,7 +117,7 @@ describe('Integration', () => { it('svg inclusion', async () => { doc = await initDOM('svg-inclusion'); expect(doc.getElementById('feature-svg-inclusion').src).toMatch( - /\/static\/media\/logo\..+\.svg$/ + /\/_assets\/media\/logo\..+\.svg$/ ); }); @@ -129,14 +129,14 @@ describe('Integration', () => { it('svg in css', async () => { doc = await initDOM('svg-in-css'); - matchCSS(doc, [/\/static\/media\/logo\..+\.svg/]); + matchCSS(doc, [/\/_assets\/media\/logo\..+\.svg/]); }); it('unknown ext inclusion', async () => { doc = await initDOM('unknown-ext-inclusion'); expect(doc.getElementById('feature-unknown-ext-inclusion').href).toMatch( - /\/static\/media\/aFileWithExt\.[a-f0-9]{8}\.unknown$/ + /\/_assets\/media\/aFileWithExt\.[a-f0-9]{8}\.unknown$/ ); }); }); diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index df52dd55058651c8d4a7bc414d536abad34c74c5..981a9403aa62b7d489d3e753df123568783d673b 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,10 +1,10 @@ { - "name": "react-scripts", - "version": "3.0.1", + "name": "@amplified/react-scripts", + "version": "0.2.0", "description": "Configuration and scripts for Create React App.", "repository": { "type": "git", - "url": "https://github.com/facebook/create-react-app.git", + "url": "https://github.com/amplifiedai/create-react-app.git", "directory": "packages/react-scripts" }, "license": "MIT", @@ -12,7 +12,7 @@ "node": ">=8.10" }, "bugs": { - "url": "https://github.com/facebook/create-react-app/issues" + "url": "https://github.com/amplifiedai/create-react-app/issues" }, "files": [ "bin", @@ -23,6 +23,9 @@ "template-typescript", "utils" ], + "scripts": { + "release": "standard-version" + }, "bin": { "react-scripts": "./bin/react-scripts.js" }, @@ -32,6 +35,7 @@ "@svgr/webpack": "4.2.0", "@typescript-eslint/eslint-plugin": "1.6.0", "@typescript-eslint/parser": "1.6.0", + "aws-sdk": "^2.465.0", "babel-eslint": "10.0.1", "babel-jest": "^24.8.0", "babel-loader": "8.0.5", @@ -72,6 +76,7 @@ "resolve": "1.10.0", "sass-loader": "7.1.0", "semver": "6.0.0", + "standard-version": "^6.0.1", "style-loader": "0.23.1", "terser-webpack-plugin": "1.2.3", "ts-pnp": "1.1.2", @@ -82,6 +87,7 @@ "workbox-webpack-plugin": "4.2.0" }, "devDependencies": { + "@amplified/node-scripts": "0.1.0", "react": "^16.8.4", "react-dom": "^16.8.4" }, @@ -99,5 +105,10 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "standard-version": { + "skip": { + "tag": true + } } } diff --git a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js index a73b8c0db3b9e2cbc8f0537963da5da93b225036..794d45645eceb1deb64f3dfcce275c910a89e8e2 100644 --- a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js +++ b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js @@ -257,7 +257,7 @@ function verifyTypeScriptSetup() { if (!fs.existsSync(paths.appTypeDeclarations)) { fs.writeFileSync( paths.appTypeDeclarations, - `/// <reference types="react-scripts" />${os.EOL}` + `/// <reference types="@amplified/react-scripts" />${os.EOL}` ); } }