-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add initial build scripts (#2)
- Loading branch information
Adam Butterworth
authored
Sep 24, 2019
1 parent
82e77ec
commit 5ec393a
Showing
29 changed files
with
20,655 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { createConfig } = require('./'); | ||
|
||
module.exports = createConfig('eslint', { | ||
rules: { | ||
'no-console': 'off', | ||
'import/no-dynamic-require': 'off', | ||
'global-require': 'off', | ||
'no-template-curly-in-string': 'off', | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
}, | ||
"env": { | ||
"es6": true | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
.eslintcache | ||
.idea | ||
.vscode | ||
coverage | ||
dist | ||
node_modules | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: node_js | ||
node_js: 12 | ||
install: | ||
- npm install | ||
script: | ||
- npm run lint | ||
after_success: | ||
- npx semantic-release | ||
env: | ||
global: | ||
# GH_TOKEN | ||
- secure: kuLoGeg37ASpPr6XEfADXKKlL/jpmnXX5gqhjJycQ+liogUQN+9NVzqeaPfGPTz9sY34F/dG7F1bR8BxGl1AxpqQsSwSD1lhCNF4j5K3bT6KIr04B1X5TDyaEXU40IP0nyrT0tFk3aaFP+mw6YHgg0KXNj/w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kXDkD9WCENrwrNeFmbK7ijdI0nlE7ZvYdSaI9ohstNFKqhaZ0r16v7t3z8xP+nL0yqM+HWLyAp2f1WsTuTMpwAY4+b47ftD2msCWWpY09BcfxmAwl8KKHIVgwSA7p6xMYk/V7P4vzKlI+IpmEWC4Xgyc= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env node | ||
|
||
process.env.PROJECT_ROOT = process.cwd(); | ||
|
||
// args come in the format: node fedx-scripts <command> <options> | ||
const args = process.argv.slice(2); | ||
const command = args.shift(); | ||
|
||
switch (command) { | ||
case 'babel': | ||
case 'eslint': | ||
case 'jest': | ||
case 'webpack': | ||
case 'webpack-dev-server': | ||
require(`../scripts/${command}.js`)(args); | ||
break; | ||
default: | ||
console.log(`fedx-scripts: The command ${command} is unsupported`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
"extends": "eslint-config-edx", | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"import/no-extraneous-dependencies": [ | ||
"error", | ||
{ | ||
"devDependencies": [ | ||
"**/*.config.*", | ||
"**/*.test.*", | ||
"**/setupTest.js", | ||
] | ||
} | ||
], | ||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/340#issuecomment-338424908 | ||
"jsx-a11y/anchor-is-valid": [ "error", { | ||
"components": [ "Link" ], | ||
"specialLink": [ "to" ] | ||
}], | ||
"jsx-a11y/label-has-for": [ 2, { | ||
"components": [ "label" ], | ||
"required": { | ||
"some": [ "nesting", "id" ] | ||
}, | ||
"allowChildren": false | ||
}] | ||
}, | ||
"env": { | ||
"jest": true | ||
}, | ||
"globals": { | ||
"newrelic": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module.exports = { | ||
presets: [ | ||
'@babel/preset-env', | ||
'@babel/preset-react', | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-object-rest-spread', | ||
'@babel/plugin-proposal-class-properties', | ||
'@babel/plugin-syntax-dynamic-import', | ||
[ | ||
'transform-imports', | ||
{ | ||
'@fortawesome/free-brands-svg-icons': { | ||
transform: '@fortawesome/free-brands-svg-icons/${member}', | ||
skipDefaultConversion: true, | ||
}, | ||
'@fortawesome/free-regular-svg-icons': { | ||
transform: '@fortawesome/free-regular-svg-icons/${member}', | ||
skipDefaultConversion: true, | ||
}, | ||
'@fortawesome/free-solid-svg-icons': { | ||
transform: '@fortawesome/free-solid-svg-icons/${member}', | ||
skipDefaultConversion: true, | ||
}, | ||
}, | ||
], | ||
], | ||
env: { | ||
i18n: { | ||
plugins: [ | ||
[ | ||
'react-intl', | ||
{ | ||
messagesDir: './temp/babel-plugin-react-intl', | ||
moduleSourceName: '@edx/frontend-i18n', | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const path = require('path'); | ||
|
||
const getProjectConfigFile = require('../lib/getProjectConfigFile'); | ||
const { PROJECT_ROOT } = require('../lib/paths'); | ||
|
||
module.exports = { | ||
testURL: 'http://localhost/', | ||
setupFiles: [ | ||
path.resolve(__dirname, 'jest/setupTest.js'), | ||
], | ||
rootDir: PROJECT_ROOT, | ||
moduleNameMapper: { | ||
'\\.svg': path.resolve(__dirname, 'jest/svgrMock.js'), | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': path.resolve(__dirname, 'jest/fileMock.js'), | ||
'\\.(css|scss)$': 'identity-obj-proxy', | ||
}, | ||
collectCoverageFrom: [ | ||
'src/**/*.{js,jsx}', | ||
], | ||
coveragePathIgnorePatterns: [ | ||
'/node_modules/', | ||
'setupTest.js', | ||
], | ||
transformIgnorePatterns: [ | ||
'/node_modules/(?!@edx)', | ||
], | ||
transform: { | ||
'^.+\\.[t|j]sx?$': [ | ||
'babel-jest', | ||
{ | ||
configFile: getProjectConfigFile('babel'), | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const dotenv = require('dotenv'); | ||
require('babel-polyfill'); | ||
|
||
const { PROJECT_ROOT } = require('../../lib/paths'); | ||
|
||
const testEnvFile = path.resolve(PROJECT_ROOT, '.env.development'); | ||
|
||
if (fs.existsSync(testEnvFile)) { | ||
dotenv.config({ path: testEnvFile }); | ||
} else { | ||
console.log(`No .env.development file found at ${testEnvFile}. No env vars will be loaded.`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { ReactComponent: 'IconMock' }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const path = require('path'); | ||
|
||
const { PROJECT_ROOT } = require('../lib/paths'); | ||
|
||
module.exports = { | ||
entry: { | ||
app: path.resolve(PROJECT_ROOT, 'src/index'), | ||
}, | ||
output: { | ||
path: path.resolve(PROJECT_ROOT, 'dist'), | ||
publicPath: '/', | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.jsx'], | ||
}, | ||
}; |
Oops, something went wrong.