You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

generator-jscad

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 2.1.0

generators/.DS_Store

8

CHANGELOG.md

@@ -0,3 +1,11 @@

## 2.1.0 (2019-01-06)
* add vuepress and vue-openjscad ([5204f44](https://gitlab.com/johnwebbcole/generator-jscad/commit/5204f44))
* add vuepress and vue-openjscad ([dac022b](https://gitlab.com/johnwebbcole/generator-jscad/commit/dac022b))
## <small>2.0.2 (2018-12-24)</small>
* 2.0.2 ([7203c0e](https://gitlab.com/johnwebbcole/generator-jscad/commit/7203c0e))
* renamed dot template files ([d23e7a0](https://gitlab.com/johnwebbcole/generator-jscad/commit/d23e7a0))

@@ -4,0 +12,0 @@

115

generators/app/index.js

@@ -1,8 +0,8 @@

"use strict";
const Generator = require("yeoman-generator");
const chalk = require("chalk");
const yosay = require("yosay");
const path = require("path");
const camelCase = require("lodash/camelCase");
const commandExists = require("command-exists").sync;
'use strict';
const Generator = require('yeoman-generator');
const chalk = require('chalk');
const yosay = require('yosay');
const path = require('path');
const camelCase = require('lodash/camelCase');
const commandExists = require('command-exists').sync;

@@ -23,3 +23,3 @@ module.exports = class extends Generator {

yosay(
`Welcome to the riveting ${chalk.red("generator-jscad")} generator!`
`Welcome to the riveting ${chalk.red('generator-jscad')} generator!`
)

@@ -30,15 +30,20 @@ );

{
name: "name",
message: "Your project name",
default: this.config.get("name") || path.basename(process.cwd())
name: 'name',
message: 'Your project name',
default: this.config.get('name') || path.basename(process.cwd())
},
{
name: "description",
message: "Description",
default: this.config.get("description")
name: 'description',
message: 'Description',
default: this.config.get('description')
},
{
name: "author",
message: "Author",
default: this.config.get("author") || this.gitc.user.name
name: 'author',
message: 'Author',
default: this.config.get('author') || this.gitc.user.name
},
{
name: 'homepage',
message: 'Do you have a homepage?',
default: this.config.get('homepage') || 'http://github.com'
}

@@ -51,5 +56,6 @@ ];

this.config.set("name", this.props.name);
this.config.set("description", this.props.description);
this.config.set("author", this.props.author);
this.config.set('name', this.props.name);
this.config.set('description', this.props.description);
this.config.set('author', this.props.author);
this.config.set('homepage', this.props.homepage);
});

@@ -60,4 +66,4 @@ }

this.fs.copyTpl(
this.templatePath("gulpfile.js"),
this.destinationPath("gulpfile.js"),
this.templatePath('gulpfile.js'),
this.destinationPath('gulpfile.js'),
{

@@ -72,14 +78,14 @@ name: this.props.name,

this.fs.copy(
this.templatePath("_eslintrc.js"),
this.destinationPath(".eslintrc.js")
this.templatePath('_eslintrc.js'),
this.destinationPath('.eslintrc.js')
);
this.fs.copy(
this.templatePath("_gitignore"),
this.destinationPath(".gitignore")
this.templatePath('_gitignore'),
this.destinationPath('.gitignore')
);
this.fs.copyTpl(
this.templatePath("package.json"),
this.destinationPath("package.json"),
this.templatePath('package.json'),
this.destinationPath('package.json'),
{

@@ -89,3 +95,4 @@ name: this.props.name,

author: this.props.author,
nameslug: camelCase(this.props.name)
nameslug: camelCase(this.props.name),
homepage: this.props.homepage
}

@@ -95,4 +102,4 @@ );

this.fs.copyTpl(
this.templatePath("README.md"),
this.destinationPath("README.md"),
this.templatePath('README.md'),
this.destinationPath('README.md'),
{

@@ -102,16 +109,38 @@ name: this.props.name,

author: this.props.author,
nameslug: camelCase(this.props.name)
nameslug: camelCase(this.props.name),
homepage: this.props.homepage
}
);
this.fs.copyTpl(
this.templatePath("main.jscad"),
this.destinationPath(this.props.name + ".jscad"),
{
name: this.props.name,
description: this.props.description,
author: this.props.author,
nameslug: camelCase(this.props.name)
}
/**
* Do not overwrite the main code file.
*/
if (!this.fs.exists(this.props.name + '.jscad')) {
this.fs.copyTpl(
this.templatePath('main.jscad'),
this.destinationPath(this.props.name + '.jscad'),
{
name: this.props.name,
description: this.props.description,
author: this.props.author,
nameslug: camelCase(this.props.name),
homepage: this.props.homepage
}
);
}
this.fs.copy(
this.templatePath('_vuepress/components/VuepressOpenJscad.vue'),
this.destinationPath('.vuepress/components/VuepressOpenJscad.vue')
);
this.fs.copy(
this.templatePath('_vuepress/config.js'),
this.destinationPath('.vuepress/config.js')
);
this.fs.copy(
this.templatePath('_gitlab-ci.yml'),
this.destinationPath('.gitlab-ci.yml')
);
}

@@ -122,6 +151,6 @@

if (commandExists("git")) {
this.composeWith(require.resolve("generator-git-init"), {});
if (commandExists('git')) {
this.composeWith(require.resolve('generator-git-init'), {});
}
}
};

@@ -6,3 +6,3 @@ module.exports = {

},
extends: ["eslint:recommended"],
extends: ['eslint:recommended'],
parserOptions: {

@@ -12,11 +12,11 @@ ecmaVersion: 2017

rules: {
"no-console": [
"error",
'no-console': [
'error',
{
allow: ["warn", "error"]
allow: ['warn', 'error']
}
],
"linebreak-style": [2, "unix"],
quotes: [2, "single"],
semi: [2, "always"]
'linebreak-style': [2, 'unix'],
quotes: [2, 'single'],
semi: [2, 'always']
},

@@ -23,0 +23,0 @@ globals: {

/* globals require */
var gulp = require("gulp");
var del = require("del");
var jscadFiles = require("gulp-jscad-files");
var merge2 = require("merge2");
var debug = require("gulp-debug");
var inject = require("gulp-inject");
var plumber = require("gulp-plumber");
var terser = require("gulp-terser");
var gulp = require('gulp');
var del = require('del');
var jscadFiles = require('gulp-jscad-files');
var merge2 = require('merge2');
var debug = require('gulp-debug');
var inject = require('gulp-inject');
var plumber = require('gulp-plumber');
var terser = require('gulp-terser');
gulp.task("clean", function(done) {
del(["dist/*"]).then(paths => {
console.log("Deleted files and folders:\n", paths.join("\n")); // eslint-disable-line no-console, no-undef
gulp.task('clean', function(done) {
del(['dist/*']).then(paths => {
console.log('Deleted files and folders:\n', paths.join('\n')); // eslint-disable-line no-console, no-undef
done();

@@ -18,5 +18,5 @@ });

gulp.task("inject", function() {
gulp.task('inject', function() {
return gulp
.src("<%= name %>.jscad")
.src('<%= name %>.jscad')
.pipe(plumber())

@@ -26,5 +26,5 @@ .pipe(

merge2(
gulp.src(["*.jscad"], { ignore: ["<%= name %>.jscad"] }),
gulp.src(['*.jscad'], { ignore: ['<%= name %>.jscad'] }),
gulp
.src("package.json")
.src('package.json')
.pipe(jscadFiles())

@@ -43,9 +43,9 @@ .pipe(

)
).pipe(debug({ title: "injecting:" })),
).pipe(debug({ title: 'injecting:' })),
{
relative: true,
starttag: "// include:js",
endtag: "// endinject",
starttag: '// include:js',
endtag: '// endinject',
transform: function(filepath, file) {
return "// " + filepath + "\n" + file.contents.toString("utf8");
return '// ' + filepath + '\n' + file.contents.toString('utf8');
}

@@ -55,10 +55,20 @@ }

)
.pipe(gulp.dest("dist"));
.pipe(gulp.dest('dist'));
});
gulp.task(
"default",
gulp.series(["clean", "inject"], function() {
'vuepress',
gulp.series(['inject'], function() {
return gulp
.src('dist/<%= name %>.jscad')
.pipe(debug({ title: 'vuepress:' }))
.pipe(gulp.dest('.vuepress/public/'));
})
);
gulp.task(
'default',
gulp.series(['clean', 'inject'], function() {
gulp.watch(
["!**/*.*~", "!dist/*", "**/*.jscad", "node_modules/"],
['!**/*.*~', '!dist/*', '**/*.jscad', 'node_modules/'],
{

@@ -69,5 +79,5 @@ verbose: true,

},
gulp.series(["inject"])
gulp.series(['inject'])
);
})
);

@@ -8,3 +8,7 @@ {

"start": "gulp",
"test": "echo \"Error: no test specified\" && exit 1"
"clean": "gulp clean",
"inject": "gulp inject",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "gulp vuepress && cross-env BASEPATH=/<%= name %>/ vuepress build",
"serve": "gulp vuepress && vuepress dev"
},

@@ -17,2 +21,5 @@ "author": "<%= author %>",

"devDependencies": {
"@jscad/web": "^1.10.0",
"@jwc/vue-openjscad": "^1.0.3",
"cross-env": "^5.2.0",
"del": "^3.0.0",

@@ -27,4 +34,5 @@ "gulp": "^4.0.0",

"gulp-watch": "^5.0.1",
"merge2": "^1.2.3"
"merge2": "^1.2.3",
"vuepress": "^0.14.8"
}
}

@@ -5,19 +5,44 @@ # <%= name %>

<vuepress-open-jscad design="<%= name %>.jscad" :panel="{size:223}" :camera="{position: {x: 0, y: 0, z: 223},clip: {min: 1, max: 1000}}"></vuepress-open-jscad>
## Running
The jscad project `<%= name %>` uses gulp to create a `dist/<%= nameslug %>.jscad` file and watches your source for changes. You can drag the `dist/<%= nameslug %>.jscad` directory into the drop area on [openjscad.org](http://openjscad.org). Make sure you check `Auto Reload` and any time you save, gulp creates the `dist/<%= nameslug %>.jscad` file, and your model should refresh.
The jscad project `<%= name %>` uses gulp to create a `dist/<%= name %>.jscad` file and watches your source for changes. You can drag the `dist/<%= name %>.jscad` directory into the drop area on [openjscad.org](http://openjscad.org). Make sure you check `Auto Reload` and any time you save, gulp creates the `dist/<%= name %>.jscad` file, and your model should refresh.
### start
`npm start` or `npm run start` will launch gulp, and create `dist/<%= name %>.jscad` . It also watches for file changes and recreates the dist file.
### clean
Deletes the `dist` directory when you run `npm run clean`.
### inject
Run gulp to combine the source files and inject the dependent libraries with `npm run inject`. Libraries are found using a gulp plugin that looks for a `jscad.json` file in a package. These files are combined and minimized before injecting into the dist file.
### build
Build the [vuepress] static site by running `npm run build`. This script combines the readme with a [vue-openjscad] component to display a live view of the model. The [baseUrl](https://vuepress.vuejs.org/guide/assets.html#base-url) is set with the `BASEPATH` environment variable. It defaults to `/<%= name %>/`. When hosted on [GitLab], the `.gitlab-ci.yml` CICD file uses this script to publish to [GitLab Pages].
See the [vue-openjscad] package for information on modifying options like the grid or initial camera position.
### serve
Run [vuepress] in dev mode with `npm run serve`. This script watches for file changes and hot reloads changes made to the README file. Changes to the model are not automatically reloaded; a manual reload is required.
## jscad-utils
The example project uses [jscad-utils](https://www.npmjs.com/package/jscad-utils). These utilities are a set of utilities that make object creation and alignment easier. To remove it, `npm uninstall --save jscad-utils`, and remove the
`util.init(CSG);` line in `<%= nameslug %>.jscad`.
The example project uses [jscad-utils]. These utilities are a set of utilities that make object creation and alignment easier. To remove it, `npm uninstall --save jscad-utils`, and remove the
`util.init(CSG);` line in `<%= name %>.jscad`.
## Other libraries
You can search [NPM](https://www.npmjs.com/search?q=jscad) for other jscad libraries. Installing them with NPM and running `gulp` should create a `dist/<%= nameslug %>.jscad` will all dependencies injected into the file.
You can search [NPM](https://www.npmjs.com/search?q=jscad) for other jscad libraries. Installing them with NPM and running `gulp` should create a `dist/<%= name %>.jscad` will all dependencies injected into the file.
For example, to load a RaspberryPi jscad library and show a Raspberry Pi Model B, install jscad-raspberrypi using `npm install --save jscad-raspberrypi`. Then return a combined `BPlus` group from the `main()` function.
For example, to load a [RaspberryPi jscad library] and show a Raspberry Pi Model B, install jscad-raspberrypi using `npm install --save jscad-raspberrypi`. Then return a combined `BPlus` group from the `main()` function.
```javascript
main() util.init(CSG);
main() {
util.init(CSG);

@@ -27,4 +52,6 @@ return RaspberryPi.BPlus().combine();

### Gist
// ********************************************************
// Other jscad libraries are injected here. Do not remove.
// Install jscad libraries using NPM
// ********************************************************
// include:js

@@ -36,22 +63,32 @@ // endinject

If you publish the `dist/<%= nameslug %>.jscad` file, you can open it directly in
If you publish the `dist/<%= name %>.jscad` file, you can open it directly in
[openjscad.org](http://openjscad.org) by using the following URL:
<openjscad.org> by using the following URL: <code>
<code>
<a href="http://openjscad.org/#">http://openjscad.org/#</a>
</code> + the url to your file.</openjscad.org>
</code> + the url to your file.
### Gist
You can save your file to a github [gist](https://gist.github.com/) and append the URL to the raw gist.
You can save your file to a GitHub [gist](https://gist.github.com/) and append the URL to the raw gist.
For example: <http://openjscad.org/#https://gist.githubusercontent.com/johnwebbcole/43f2ef58532a204c694e5ada16888ecd/raw/d0972463f70222e6d4c6c6196a1c759bb3e2362a/snap.jscad>
For example <http://openjscad.org/#https://gist.githubusercontent.com/johnwebbcole/43f2ef58532a204c694e5ada16888ecd/raw/d0972463f70222e6d4c6c6196a1c759bb3e2362a/snap.jscad>
### Pastebin
### Gitlab Snippet
Or use [pastebin](http://pastebin.com/) like:
If you save to a gitlab public snippet, you can open it using the following URL:
<http://openjscad.org/#http://pastebin.com/raw/9CjvuhSi>
<https://openjscad.org/#https://gitlab.com/snippets/1795323/raw.jscad>
Make sure you change the snippet id to the correct value and add `.jscad` at the end.
## License
ISC © [<%= author %>](http://github.com/)
ISC © [<%= author %>](<%= homepage %>)
[raspberrypi jscad library]: https://gitlab.com/johnwebbcole/jscad-raspberrypi
[vuepress]: https://vuepress.vuejs.org/
[jscad-utils]: https://www.npmjs.com/package/jscad-utils
[gitlab]: https://gitlab.com/
[gitlab pages]: https://gitlab.com/help/user/project/pages/index.md
[vue-openjscad]: https://gitlab.com/johnwebbcole/vue-openjscad
{
"name": "generator-jscad",
"version": "2.0.2",
"version": "2.1.0",
"description": "Create a jscad project",

@@ -5,0 +5,0 @@ "homepage": "https://gitlab.com/johnwebbcole/generator-jscad",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc