-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Projects v2.0 #565
base: master
Are you sure you want to change the base?
Projects v2.0 #565
Changes from 10 commits
c2d98c3
78d865d
52065b8
64503c7
ead3be4
8214eee
18bad58
c890071
9447421
8ba3423
3b47604
583580d
1479f2d
552f719
85b5e89
4f948f7
f52a9a5
b82ff4c
9e405dd
1820242
ab49583
4ea8d9a
0f40220
86ac7c6
1e4473c
3a88ed9
7af6dce
d28be78
b9edd7f
4172e52
41c56f3
b144258
b8c4208
a7ce613
4152a69
2b7b1b3
1094daa
a6d6b95
921155b
6eeb280
ca0f09b
5c5c849
c6655ae
50d3960
50db25c
add3cf8
31e0582
187f163
41da0c7
fae0d8d
bb79dc8
68c5c0c
dd5851e
86ade20
5581d8e
23957f8
c7b8d7b
1557496
1ef5fd9
d5fb048
813af50
a5f1f2e
f2fa81c
7faad84
f2bf55d
7ed753d
c9f49aa
ab8f1eb
c3e046c
65ae405
5dd1c0b
fbee5f3
5e61b64
bb2989f
ddeb5ad
ab76745
76e9817
b4738f3
2995dc9
26ec256
20702ec
3fa8c43
a9acab9
5306b21
e8c7da7
37b65e1
83b34a0
b404486
607deb0
60c1de9
6fc74b3
452e698
dbd2260
a3495f8
640d74b
2cb78fa
2b0e772
ee0f087
2383d83
c134b37
460e147
8de047e
9b9e016
7c76c64
488adc7
2c16c07
f7eeb17
4cb9eae
593a9b8
c0fe5b3
b180237
6ffff11
dec4014
3e39c35
68792c7
69058ea
06ce12d
f1c2f3f
bb5220f
6199ce8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# IDE & OS specific | ||
.DS_Store | ||
.idea | ||
.github | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Dependencies | ||
node_modules | ||
|
||
# Coverage | ||
coverage | ||
|
||
# Types | ||
flow-typed/npm/* | ||
!flow-typed/npm/module_vx.x.x.js | ||
|
||
# Release | ||
dist/* | ||
|
||
#build | ||
package-lock.json | ||
yarn.lock | ||
.vscode |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
language: node_js | ||
node_js: | ||
- "lts/*" | ||
- "node" | ||
- 12 | ||
|
||
#before_script: npm run lint | ||
#script: npm run test | ||
#after_success: npm run coveralls | ||
|
||
install: | ||
- npm install | ||
|
||
# as our module should have an additional files, generated before publishing we're using this line below | ||
# should we add more stuff here as well? or @TODO move something out when generator will be a separated thing | ||
before_script: npm run generateFiles | ||
|
||
|
||
script: | ||
- npm test | ||
- npm run test:cover | ||
- npm run jsonlint | ||
- npm run build | ||
# we need to move coveralls from fetch and run it here as well | ||
|
||
# script: | ||
# - npm test | ||
# - npm run jsonlint | ||
# - npm run json-vaidation | ||
# - npm run build | ||
# - npm run install | ||
|
||
branches: | ||
only: | ||
- master |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict' | ||
|
||
const presets = [ | ||
['@babel/preset-env', { | ||
'modules': false | ||
}] | ||
// { | ||
// | ||
// } | ||
] | ||
// Add this to working tests | ||
// const env = { | ||
// test: { | ||
// presets: [['@babel/preset-env']] | ||
// } | ||
// } | ||
|
||
const plugins = [ | ||
[ | ||
require.resolve('babel-plugin-module-resolver'), | ||
{ | ||
root: ['./src/'], | ||
alias: { | ||
'~': './src/data', | ||
'@utils': './src/utils.js', | ||
'@generator': './generator' | ||
} | ||
} | ||
], | ||
[ | ||
'@babel/plugin-syntax-dynamic-import' | ||
] | ||
|
||
] | ||
|
||
module.exports = { presets, plugins } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
verbose: true, | ||
collectCoverageFrom: ['src/**'], | ||
coverageReporters: ['json', 'lcov', 'text-summary', 'html'], | ||
testURL: 'http://localhost', | ||
testPathIgnorePatterns: [ | ||
'/dist/' | ||
], | ||
moduleDirectories: ['node_modules'], | ||
transformIgnorePatterns: ['<rootDir>/node_modules/'] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// at this file we'll run nodejs command | ||
var shell = require('shelljs') | ||
const _ = require('lodash') | ||
|
||
// @TODO add here all new generated at generator files too | ||
// @TODO looks like jsonlint doesnt called without build... strange | ||
const jsonFiles = require('./src/files.js') | ||
|
||
// each can be used instead of forEach | ||
// @TODO replace with lodash | ||
_.forEach(Object.keys(jsonFiles), function (key) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identical blocks of code found in 8 locations. Consider refactoring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identical blocks of code found in 8 locations. Consider refactoring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identical blocks of code found in 8 locations. Consider refactoring. |
||
try { | ||
shell.exec('jsonlint ' + jsonFiles[key], { silent: true }) | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
|
||
// // Run external tool synchronously | ||
// if (shell.exec('git commit -am "Auto-commit"').code !== 0) { | ||
// shell.echo('Error: Git commit failed'); | ||
// shell.exit(1); | ||
// } | ||
}) | ||
|
||
// Check if path exist | ||
// @TODO lodash | ||
Object.keys(jsonFiles).forEach(function (key) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identical blocks of code found in 7 locations. Consider refactoring. |
||
if (shell.test('-e', jsonFiles[key])) { | ||
// console.log("File exist " + jsonFiles[key]); | ||
} else { | ||
// console.log("File doesn't exist " + jsonFiles[key]); | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"name": "@groceristar/sd-wrapper/gs-graphql-backend", | ||
"version": "0.0.1", | ||
"license": "MIT", | ||
"scripts": { | ||
"bundle": "rollup -c", | ||
"dev": "rollup -c -w", | ||
"build": "npm run clean && npm run bundle", | ||
"#prepare": "yarn clean", | ||
"clean": "shx rm -rf ./coverage && shx rm -rf ./dist", | ||
"prepublish": "yarn clean && yarn code-fix && yarn build", | ||
"test": "CI=test && jest", | ||
"test:watch": "jest --watch", | ||
"test:cover": "jest --coverage", | ||
"jsonlint": "node jsonlint.config.js", | ||
"lint": "standard", | ||
"format": "prettier" | ||
}, | ||
"description": "xxx", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.es.js", | ||
"browser": "dist/index.iife.js", | ||
"repository": "xxx", | ||
"author": "Arthur Tkachenko", | ||
"private": false, | ||
"release": { | ||
"publishDir": "dist" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.4.4", | ||
"@babel/core": "7.4.5", | ||
"@babel/plugin-syntax-dynamic-import": "7.2.0", | ||
"@babel/preset-env": "7.4.5", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-jest": "24.8.0", | ||
"babel-plugin-module-resolver": "3.2.0", | ||
"coveralls": "3.0.4", | ||
"husky": "2.4.1", | ||
"jest": "24.8.0", | ||
"jest-json-schema": "2.0.2", | ||
"jsonlint": "1.6.3", | ||
"lint-staged": "8.2.1", | ||
|
||
"regenerator-runtime": "0.13.2", | ||
"rollup": "1.15.6", | ||
"rollup-plugin-babel": "4.3.2", | ||
"rollup-plugin-commonjs": "10.0.0", | ||
"rollup-plugin-copy-assets": "2.0.1", | ||
"rollup-plugin-json": "4.0.0", | ||
"rollup-plugin-node-builtins": "2.1.2", | ||
"rollup-plugin-node-resolve": "5.0.3", | ||
"rollup-plugin-notify": "1.1.0", | ||
"rollup-plugin-replace": "2.2.0", | ||
"shelljs": "0.8.3", | ||
"shelljs.exec": "1.1.8", | ||
"shx": "0.3.2", | ||
"standard": "12.0.1" | ||
}, | ||
"peerDependencies": {}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
|
||
"lodash": "^4.17.11", | ||
"path": "^0.12.7", | ||
"uuid": "^3.3.2", | ||
|
||
}, | ||
"lint-staged": { | ||
"linters": { | ||
"*.js": [ | ||
"npm run code-fix", | ||
"git add" | ||
] | ||
}, | ||
"ignore": [ | ||
"**/dist/*.js" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"config:base" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// plugins that we are going to use | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import resolve from 'rollup-plugin-node-resolve' | ||
import json from 'rollup-plugin-json' | ||
// import copy from 'rollup-plugin-copy-assets' | ||
import builtins from 'rollup-plugin-node-builtins' | ||
import babel from 'rollup-plugin-babel' | ||
import pkg from './package.json' | ||
import notify from 'rollup-plugin-notify' | ||
|
||
// import cleanup from 'rollup-plugin-cleanup'; | ||
// https://github.com/mjeanroy/rollup-plugin-prettier | ||
// https://gitlab.com/IvanSanchez/rollup-plugin-file-as-blob | ||
|
||
const extensions = [ | ||
'.js', '.json' | ||
] | ||
|
||
const name = 'StaticDataWrapper' | ||
|
||
// packages that should be treated as external or global dependencies, not bundled | ||
const { external, globals } = { | ||
'globals': { | ||
'fs': 'fs', | ||
'uuid': 'uuid', | ||
'path': 'path' | ||
}, | ||
'external': [ | ||
'fs', | ||
'path', | ||
'uuid' | ||
] | ||
} | ||
|
||
export default { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identical blocks of code found in 7 locations. Consider refactoring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identical blocks of code found in 8 locations. Consider refactoring. |
||
// source file / entrypoint | ||
input: './src/index.js', | ||
|
||
// Specify here external modules which you don't want to include in your bundle (for instance: 'lodash', 'moment' etc.) | ||
// https://rollupjs.org/guide/en#external-e-external | ||
external, | ||
globals, | ||
|
||
// list of plugins used during building process | ||
plugins: [ | ||
// Allows node_modules resolution | ||
resolve({ extensions }), | ||
|
||
// Allow bundling cjs modules. Rollup doesn't understand cjs | ||
commonjs({ | ||
namedExports: { | ||
// // left-hand side can be an absolute path, a path | ||
// // relative to the current directory, or the name | ||
// // of a module in node_modules | ||
// 'node_modules/my-lib/index.js': [ 'named' ] | ||
'~/Allergy/allergies.json': [ 'allergies' ] | ||
} | ||
}), | ||
|
||
// Compile TypeScript/JavaScript files | ||
babel({ | ||
extensions, | ||
include: ['src/*'], | ||
// include: ['src/**/*'], | ||
exclude: [ | ||
'node_modules/**', | ||
'/src/data/__tests__' | ||
// '/src/data/json-tests' | ||
] | ||
// exclude: 'node_modules/**' | ||
// presets: presets, | ||
// plugins: plugins | ||
}), | ||
|
||
// Allow Rollup to import data from JSON file | ||
// json() | ||
json({ | ||
include: 'src/data/**', | ||
|
||
// for tree-shaking, properties will be declared as | ||
// variables, using either `var` or `const` | ||
preferConst: true, | ||
|
||
// generate a named export for every property of the JSON object | ||
namedExports: true // Default: true | ||
|
||
}), | ||
|
||
// juck fix in order to move json files to npm | ||
// copy({ | ||
// assets: [ | ||
// './src/data/**' | ||
// ], | ||
// }), | ||
|
||
builtins(), | ||
|
||
// Displays rollup errors as system notifications | ||
notify() | ||
|
||
], | ||
|
||
// output configuration | ||
output: [{ | ||
file: pkg.main, | ||
format: 'cjs' | ||
}, { | ||
file: pkg.module, | ||
format: 'es' | ||
}, { | ||
file: pkg.browser, | ||
format: 'iife', | ||
name | ||
|
||
// https://rollupjs.org/guide/en#output-globals-g-globals | ||
// globals: {} | ||
}] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# IDE & OS specific | ||
.DS_Store | ||
.idea | ||
.github | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Dependencies | ||
node_modules | ||
|
||
# Coverage | ||
coverage | ||
|
||
# Types | ||
flow-typed/npm/* | ||
!flow-typed/npm/module_vx.x.x.js | ||
|
||
# Release | ||
dist/* | ||
|
||
#build | ||
package-lock.json | ||
yarn.lock | ||
.vscode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 7 locations. Consider refactoring.