Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix/clean_up #1

Merged
merged 2 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Created by https://www.gitignore.io/api/macos,javascript,node
# Edit at https://www.gitignore.io/?templates=macos,javascript,node

#!! ERROR: javascript is undefined. Use list command to see defined gitignore types !!#

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# End of https://www.gitignore.io/api/macos,javascript,node
34 changes: 14 additions & 20 deletions generator/index.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
let ui5 = `\nVue.config.ignoredElements = [/^ui5-/];`;
let ui5 = "\nVue.config.ignoredElements = [/^ui5-/];";

module.exports = (api, opts, rootOptions) => {
module.exports = (api, options, rootOptions) => {
api.extendPackage({
dependencies: {
"@ui5/webcomponents": "^0.9.0"
}
});
if (opts.addExample) {
api.render('./template', {
...opts,
if (options.addExample) {
api.render("./template", {
...options
});
}
api.onCreateComplete(() => {
// inject to main.js
const fs = require('fs');
const ext = api.hasPlugin('typescript') ?
'ts' :
'js';
const fs = require("fs");
const ext = api.hasPlugin("typescript")
? "ts"
: "js";
const mainPath = api.resolve(`./src/main.${ext}`);
// get content
let contentMain = fs.readFileSync(mainPath, {
encoding: 'utf-8'
});
let contentMain = fs.readFileSync(mainPath, {encoding: "utf-8"});
const lines = contentMain
.split(/\r?\n/g)
.reverse();

// inject import
const lastImportIndex = lines.findIndex(line => line.match(/^import/));
lines[lastImportIndex] += ui5;

// modify app
contentMain = lines
.reverse()
.join('\n');
fs.writeFileSync(mainPath, contentMain, {
encoding: 'utf-8'
});
.join("\n");
fs.writeFileSync(mainPath, contentMain, {encoding: "utf-8"});
api.exitLog("Successfully installed UI5 Web Components", "done");
});
}
};
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
module.exports = (api, opts) => {}
module.exports = (api, opts) => {
api.chaiWebpack(config => {
config
.module
.rule("loader")
.test(/\.(png|jpg|gif)$/)
.use("file-loader")
.loader("file-loader")
})
}
Loading