Skip to content

Commit

Permalink
Rename files and restructure folder layout (cncjs#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Apr 26, 2019
1 parent c10e694 commit 8768197
Show file tree
Hide file tree
Showing 652 changed files with 10,513 additions and 10,062 deletions.
20 changes: 0 additions & 20 deletions .babelrc

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8
FROM node:10
MAINTAINER Cheton Wu <[email protected]>

ADD package.json package.json
Expand All @@ -7,4 +7,4 @@ RUN npm install --production

ADD . .
EXPOSE 8000
CMD ["bin/cnc"]
CMD ["bin/cncjs"]
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ For a more complete introduction, see the [Introduction](https://github.com/cncj
Version | Supported Level
:------- |:---------------
4 | Dropped support
6 | <b>Recommended for production use</b>
8 | <b>Recommended for production use</b>
9 | Supported
6 | Supported
8 | Supported
10 | Supported

## Getting Started
Expand All @@ -98,8 +97,8 @@ export NVM_DIR="$HOME/.nvm"

Once installed, you can select Node.js versions with:
```
nvm install 6
nvm use 6
nvm install 10
nvm use 10
```

It's also recommended that you upgrade npm to the latest version. To upgrade, run:
Expand Down
10 changes: 10 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
extends: '@trendmicro/babel-config',
presets: [
'@babel/preset-env',
'@babel/preset-react'
],
plugins: [
'lodash'
]
};
16 changes: 8 additions & 8 deletions bin/cnc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env node

require('babel-polyfill');
require('@babel/polyfill');

var cnc;
const chalk = require('chalk');

if (process.env.NODE_ENV === 'development') {
cnc = require('../output/cnc').default;
} else {
cnc = require('../dist/cnc/cnc').default;
}
console.warn(chalk.yellow('Warning: The "cnc" executable is deprecated and will be removed in the next major release. Use "cncjs" instead to avoid deprecation.\n'));

cnc().catch(err => {
const launchServer = (process.env.NODE_ENV === 'development')
? require('../output/server-cli').default
: require('../dist/cncjs/server-cli').default;

launchServer().catch(err => {
console.error('Error:', err);
});
11 changes: 11 additions & 0 deletions bin/cncjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env node

require('@babel/polyfill');

const launchServer = (process.env.NODE_ENV === 'development')
? require('../output/server-cli').default
: require('../dist/cncjs/server-cli').default;

launchServer().catch(err => {
console.error('Error:', err);
});
4 changes: 2 additions & 2 deletions examples/.cncrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"commands": [
{
"title": "Update (root user)",
"commands": "sudo npm install -g cncjs@latest --unsafe-perm; pkill -a -f cnc"
"commands": "sudo npm install -g cncjs@latest --unsafe-perm; pkill -a -f cncjs"
},
{
"title": "Update (non-root user)",
"commands": "npm install -g cncjs@latest; pkill -a -f cnc"
"commands": "npm install -g cncjs@latest; pkill -a -f cncjs"
},
{
"title": "Reboot",
Expand Down
28 changes: 19 additions & 9 deletions i18next-scanner.webconfig.js → i18next-scanner.config.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const languages = require('./build.config').languages;

module.exports = {
src: [
'src/web/**/*.{html,hbs,js,jsx}',
'src/app/**/*.{html,hbs,js,jsx}',
// Use ! to filter out files or directories
'!src/web/{vendor,i18n}/**',
'!src/app/{vendor,i18n}/**',
'!test/**',
'!**/node_modules/**'
],
Expand All @@ -17,24 +17,34 @@ module.exports = {
debug: false,
removeUnusedKeys: true,
sort: false,
lngs: languages,
func: {
list: [], // Use an empty array to bypass the default list: i18n.t, i18next.t
extensions: ['.js', '.jsx']
},
defaultValue: (lng, ns, key) => {
if (lng === 'en') {
return key; // Use key as value for base language
trans: {
component: 'I18n',
i18nKey: 'i18nKey',
defaultsKey: 'defaults',
extensions: ['.js', '.jsx'],
fallbackKey: function(ns, value) {
return value;
}
return ''; // Return empty string for other languages
},
lngs: languages,
ns: [
'gcode',
'resource' // default
],
defaultNs: 'resource',
defaultValue: (lng, ns, key) => {
if (lng === 'en') {
return key; // Use key as value for base language
}
return ''; // Return empty string for other languages
},
resource: {
loadPath: 'src/web/i18n/{{lng}}/{{ns}}.json',
savePath: 'src/web/i18n/{{lng}}/{{ns}}.json', // or 'src/web/i18n/${lng}/${ns}.saveAll.json'
loadPath: 'src/app/i18n/{{lng}}/{{ns}}.json',
savePath: 'src/app/i18n/{{lng}}/{{ns}}.json', // or 'src/app/i18n/${lng}/${ns}.saveAll.json'
jsonIndent: 4
},
nsSeparator: ':', // namespace separator
Expand Down
16 changes: 13 additions & 3 deletions i18next-scanner.appconfig.js → i18next-scanner.config.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,30 @@ const languages = require('./build.config').languages;
module.exports = {
options: {
debug: false,
removeUnusedKeys: false,
sort: false,
func: {
list: ['i18n.t', 't'],
extensions: ['.js', '.jsx']
},
trans: {
component: 'I18n',
i18nKey: 'i18nKey',
defaultsKey: 'defaults',
extensions: ['.js', '.jsx'],
fallbackKey: function(ns, value) {
return value;
}
},
lngs: languages,
defaultValue: '__L10N__', // to indicate that a default value has not been defined for the key
ns: [
'resource' // default
],
defaultNs: 'resource',
defaultValue: '__L10N__', // to indicate that a default value has not been defined for the key
resource: {
loadPath: 'src/app/i18n/{{lng}}/{{ns}}.json',
savePath: 'src/app/i18n/{{lng}}/{{ns}}.json', // or 'src/app/i18n/${lng}/${ns}.saveAll.json'
loadPath: 'src/server/i18n/{{lng}}/{{ns}}.json',
savePath: 'src/server/i18n/{{lng}}/{{ns}}.json', // or 'src/server/i18n/${lng}/${ns}.saveAll.json'
jsonIndent: 4
},
nsSeparator: ':', // namespace separator
Expand Down
2 changes: 2 additions & 0 deletions src/web/assets/index.hbs → index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<title>{{title}}</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="shortcut icon" href="{{webroot}}favicon.ico">
</head>
<body>
Expand Down
Loading

0 comments on commit 8768197

Please sign in to comment.