Skip to content

Commit

Permalink
Merge pull request #156 from dnbexperience/develop
Browse files Browse the repository at this point in the history
fix icons path issue on "es" modules usage
  • Loading branch information
tujoworker authored Apr 6, 2019
2 parents 02bd857 + e1bffc6 commit ba4dfa8
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 453 deletions.
2 changes: 1 addition & 1 deletion packages/dnb-design-system-portal/scripts/commitPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (require.main === module) {
commitToBranch({
requiredBranch: 'develop',
what: 'pages',
filePathsWhitelist: ['/src/pages/', '/src/uilib/'],
filePathsWhitelist: ['/version.json', '/src/pages/', '/src/uilib/'],
isFeature: false
})
}
42 changes: 35 additions & 7 deletions packages/dnb-design-system-portal/scripts/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ import { isCI } from 'ci-info'
import packageJson, { buildVersion } from '../package.json'

export const currentVersion = buildVersion
export const createNewVersion = async () => {

// run only if the script was executed from command line
if (
require.main === module &&
process.argv.indexOf('--new-version') !== -1
) {
createNewVersion()
createNewChangelogVersion()
}

async function createNewVersion() {
if (!isCI) {
console.log(
'You may only set a new deploy version on a CI environment!'
Expand All @@ -34,10 +44,28 @@ export const createNewVersion = async () => {
}
}

// run only if the script was executed from command line
if (
require.main === module &&
process.argv.indexOf('--new-version') !== -1
) {
createNewVersion()
async function createNewChangelogVersion() {
if (!isCI) {
console.log(
'You may only set a new deploy version on a CI environment!'
)
return false
}
try {
const changelogFilePath = path.resolve(
__dirname,
'../../../',
'CHANGELOG.md'
)
const content = await fs.readFile(changelogFilePath, 'utf-8')

const version = String(/^#+\s(.*)\n/g.exec(content)[0])
.replace(/#+/, '')
.trim()

const exportedFile = path.resolve(__dirname, '../', 'version.json')
await fs.writeFile(exportedFile, JSON.stringify({ version }))
} catch (e) {
console.log(`Failed to create new static version file! \n${e.message}`)
}
}
1 change: 1 addition & 0 deletions packages/dnb-design-system-portal/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"March, 22. 2019"}
12 changes: 6 additions & 6 deletions packages/dnb-ui-lib/scripts/prepub/tasks/makeLibModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ const transformContentRevertForES = content => {
if (/\.min\.css/.test(content)) {
content = content.replace(new RegExp('/(.*).min.css', 'g'), '/$1.css')
}
// if (new RegExp('../../').test(content)) {
// content = content.replace(
// new RegExp('../../(.*).css', 'g'),
// '../../../$1.css'
// )
// }
if (new RegExp('../../').test(content)) {
content = content.replace(
new RegExp("'../../icons/", 'g'),
"'../../../icons/"
)
}
return content
}
10 changes: 5 additions & 5 deletions packages/examples/example-angular-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"version": "1.0.0",
"scripts": {
"start": "webpack-serve --port=1234",
"start": "webpack-dev-server --port=1234",
"build": "webpack --mode=production --display-modules"
},
"dependencies": {
Expand All @@ -21,14 +21,14 @@
"devDependencies": {
"@types/angular": "1.6.54",
"prop-types": "^15.7.2",
"babel-loader": "8.0.5",
"babel-loader": "^8.0.5",
"file-loader": "^3.0.1",
"css-loader": "^2.1.1",
"node-sass": "^4.11.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "4.29.6",
"webpack-cli": "3.3.0",
"webpack-serve": "2.0.3"
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
}
}
10 changes: 5 additions & 5 deletions packages/examples/example-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"version": "1.0.0",
"scripts": {
"start": "webpack-serve --port=1234",
"start": "webpack-dev-server --port=1234",
"build": "webpack --mode=production --display-modules"
},
"dependencies": {
Expand All @@ -17,16 +17,16 @@
"react-dom": "^16.8.4"
},
"devDependencies": {
"babel-loader": "8.0.5",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0",
"prop-types": "^15.7.2",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "4.29.6",
"webpack-cli": "3.3.0",
"webpack-serve": "2.0.3"
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
}
}
10 changes: 5 additions & 5 deletions packages/examples/example-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"version": "1.0.0",
"scripts": {
"start": "webpack-serve --port=1234",
"start": "webpack-dev-server --port=1234",
"build": "webpack --mode=production --display-modules"
},
"dependencies": {
Expand All @@ -20,7 +20,7 @@
},
"devDependencies": {
"@vue/component-compiler-utils": "^2.6.0",
"babel-loader": "8.0.5",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"eslint-plugin-vue": "^5.2.2",
"file-loader": "^3.0.1",
Expand All @@ -32,8 +32,8 @@
"vue-loader": "^15.7.0",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.9",
"webpack": "4.29.6",
"webpack-cli": "3.3.0",
"webpack-serve": "2.0.3"
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
}
}
10 changes: 5 additions & 5 deletions packages/examples/example-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"version": "1.0.0",
"scripts": {
"start": "webpack-serve --port=1234",
"start": "webpack-dev-server --port=1234",
"build": "webpack --mode=production --display-modules"
},
"dependencies": {
Expand All @@ -17,15 +17,15 @@
"react-dom": "^16.8.4"
},
"devDependencies": {
"babel-loader": "8.0.5",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"node-sass": "^4.11.0",
"prop-types": "^15.7.2",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "4.29.6",
"webpack-cli": "3.3.0",
"webpack-serve": "2.0.3"
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
}
}
Loading

0 comments on commit ba4dfa8

Please sign in to comment.