311 | # container, that host's errors will be logged there and not here.
312 | #
313 | ErrorLog /proc/self/fd/2
314 |
315 | #
316 | # LogLevel: Control the number of messages logged to the error_log.
317 | # Possible values include: debug, info, notice, warn, error, crit,
318 | # alert, emerg.
319 | #
320 | LogLevel warn
321 |
322 |
323 | #
324 | # The following directives define some format nicknames for use with
325 | # a CustomLog directive (see below).
326 | #
327 | LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
328 | LogFormat "%h %l %u %t \"%r\" %>s %b" common
329 |
330 |
331 | # You need to enable mod_logio.c to use %I and %O
332 | LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
333 |
334 |
335 | #
336 | # The location and format of the access logfile (Common Logfile Format).
337 | # If you do not define any access logfiles within a
338 | # container, they will be logged here. Contrariwise, if you *do*
339 | # define per- access logfiles, transactions will be
340 | # logged therein and *not* in this file.
341 | #
342 | CustomLog /proc/self/fd/1 common
343 |
344 | #
345 | # If you prefer a logfile with access, agent, and referer information
346 | # (Combined Logfile Format) you can use the following directive.
347 | #
348 | #CustomLog "logs/access_log" combined
349 |
350 |
351 |
352 | #
353 | # Redirect: Allows you to tell clients about documents that used to
354 | # exist in your server's namespace, but do not anymore. The client
355 | # will make a new request for the document at its new location.
356 | # Example:
357 | # Redirect permanent /foo http://www.example.com/bar
358 |
359 | #
360 | # Alias: Maps web paths into filesystem paths and is used to
361 | # access content that does not live under the DocumentRoot.
362 | # Example:
363 | # Alias /webpath /full/filesystem/path
364 | #
365 | # If you include a trailing / on /webpath then the server will
366 | # require it to be present in the URL. You will also likely
367 | # need to provide a section to allow access to
368 | # the filesystem path.
369 |
370 | #
371 | # ScriptAlias: This controls which directories contain server scripts.
372 | # ScriptAliases are essentially the same as Aliases, except that
373 | # documents in the target directory are treated as applications and
374 | # run by the server when requested rather than as documents sent to the
375 | # client. The same rules about trailing "/" apply to ScriptAlias
376 | # directives as to Alias.
377 | #
378 | ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
379 |
380 |
381 |
382 |
383 | #
384 | # ScriptSock: On threaded servers, designate the path to the UNIX
385 | # socket used to communicate with the CGI daemon of mod_cgid.
386 | #
387 | #Scriptsock cgisock
388 |
389 |
390 | #
391 | # "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
392 | # CGI directory exists, if you have that configured.
393 | #
394 |
395 | AllowOverride None
396 | Options None
397 | Require all granted
398 |
399 |
400 |
401 | #
402 | # Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
403 | # backend servers which have lingering "httpoxy" defects.
404 | # 'Proxy' request header is undefined by the IETF, not listed by IANA
405 | #
406 | RequestHeader unset Proxy early
407 |
408 |
409 |
410 | #
411 | # TypesConfig points to the file containing the list of mappings from
412 | # filename extension to MIME-type.
413 | #
414 | TypesConfig conf/mime.types
415 |
416 | #
417 | # AddType allows you to add to or override the MIME configuration
418 | # file specified in TypesConfig for specific file types.
419 | #
420 | #AddType application/x-gzip .tgz
421 | #
422 | # AddEncoding allows you to have certain browsers uncompress
423 | # information on the fly. Note: Not all browsers support this.
424 | #
425 | #AddEncoding x-compress .Z
426 | #AddEncoding x-gzip .gz .tgz
427 | #
428 | # If the AddEncoding directives above are commented-out, then you
429 | # probably should define those extensions to indicate media types:
430 | #
431 | AddType application/x-compress .Z
432 | AddType application/x-gzip .gz .tgz
433 |
434 | #
435 | # AddHandler allows you to map certain file extensions to "handlers":
436 | # actions unrelated to filetype. These can be either built into the server
437 | # or added with the Action directive (see below)
438 | #
439 | # To use CGI scripts outside of ScriptAliased directories:
440 | # (You will also need to add "ExecCGI" to the "Options" directive.)
441 | #
442 | #AddHandler cgi-script .cgi
443 |
444 | # For type maps (negotiated resources):
445 | #AddHandler type-map var
446 |
447 | #
448 | # Filters allow you to process content before it is sent to the client.
449 | #
450 | # To parse .shtml files for server-side includes (SSI):
451 | # (You will also need to add "Includes" to the "Options" directive.)
452 | #
453 | #AddType text/html .shtml
454 | #AddOutputFilter INCLUDES .shtml
455 |
456 |
457 | #
458 | # The mod_mime_magic module allows the server to use various hints from the
459 | # contents of the file itself to determine its type. The MIMEMagicFile
460 | # directive tells the module where the hint definitions are located.
461 | #
462 | #MIMEMagicFile conf/magic
463 |
464 | #
465 | # Customizable error responses come in three flavors:
466 | # 1) plain text 2) local redirects 3) external redirects
467 | #
468 | # Some examples:
469 | #ErrorDocument 500 "The server made a boo boo."
470 | #ErrorDocument 404 /missing.html
471 | #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
472 | #ErrorDocument 402 http://www.example.com/subscription_info.html
473 | #
474 |
475 | #
476 | # MaxRanges: Maximum number of Ranges in a request before
477 | # returning the entire resource, or one of the special
478 | # values 'default', 'none' or 'unlimited'.
479 | # Default setting is to accept 200 Ranges.
480 | #MaxRanges unlimited
481 |
482 | #
483 | # EnableMMAP and EnableSendfile: On systems that support it,
484 | # memory-mapping or the sendfile syscall may be used to deliver
485 | # files. This usually improves server performance, but must
486 | # be turned off when serving from networked-mounted
487 | # filesystems or if support for these functions is otherwise
488 | # broken on your system.
489 | # Defaults: EnableMMAP On, EnableSendfile Off
490 | #
491 | #EnableMMAP off
492 | #EnableSendfile on
493 |
494 | # Supplemental configuration
495 | #
496 | # The configuration files in the conf/extra/ directory can be
497 | # included to add extra features or to modify the default configuration of
498 | # the server, or you may simply copy their contents here and change as
499 | # necessary.
500 |
501 | # Server-pool management (MPM specific)
502 | #Include conf/extra/httpd-mpm.conf
503 |
504 | # Multi-language error messages
505 | #Include conf/extra/httpd-multilang-errordoc.conf
506 |
507 | # Fancy directory listings
508 | #Include conf/extra/httpd-autoindex.conf
509 |
510 | # Language settings
511 | #Include conf/extra/httpd-languages.conf
512 |
513 | # User home directories
514 | #Include conf/extra/httpd-userdir.conf
515 |
516 | # Real-time info on requests and configuration
517 | #Include conf/extra/httpd-info.conf
518 |
519 | # Virtual hosts
520 | #Include conf/extra/httpd-vhosts.conf
521 |
522 | # Local access to the Apache HTTP Server Manual
523 | #Include conf/extra/httpd-manual.conf
524 |
525 | # Distributed authoring and versioning (WebDAV)
526 | #Include conf/extra/httpd-dav.conf
527 |
528 | # Various default settings
529 | #Include conf/extra/httpd-default.conf
530 |
531 | # Configure mod_proxy_html to understand HTML4/XHTML1
532 |
533 | Include conf/extra/proxy-html.conf
534 |
535 |
536 | # Secure (SSL/TLS) connections
537 | #Include conf/extra/httpd-ssl.conf
538 | #
539 | # Note: The following must must be present to support
540 | # starting without SSL on platforms with no /dev/random equivalent
541 | # but a statically compiled-in mod_ssl.
542 | #
543 |
544 | SSLRandomSeed startup builtin
545 | SSLRandomSeed connect builtin
546 |
547 |
548 |
--------------------------------------------------------------------------------
/modules/typescript.js:
--------------------------------------------------------------------------------
1 | const tsLoader = {
2 | loader: 'ts-loader',
3 | options: { appendTsSuffixTo: [/\.vue$/] },
4 | };
5 |
6 | module.exports = function() {
7 | // Add .ts extension for store, middleware and more
8 | this.nuxt.options.extensions.push('ts');
9 | // Extend build
10 | this.extendBuild(config => {
11 | // Add TypeScript loader
12 | config.module.rules.push({ test: /((client|server)\.js)|(\.tsx?)$/, ...tsLoader });
13 | // Add TypeScript loader for vue files
14 | config.module.rules
15 | .filter(rule => rule.loader === 'vue-loader')
16 | .forEach(rule => (rule.options.loaders.ts = tsLoader));
17 | // Add .ts extension in webpack resolve
18 | if (config.resolve.extensions.indexOf('.ts') === -1) {
19 | config.resolve.extensions.push('.ts');
20 | }
21 | });
22 | };
23 |
--------------------------------------------------------------------------------
/nuxt.config.js:
--------------------------------------------------------------------------------
1 | const parseArgs = require('minimist');
2 | const postcssImport = require('postcss-import');
3 | const postcssCustomProperties = require('postcss-custom-properties');
4 | const postcssCustomMedia = require('postcss-custom-media');
5 | const postcssNested = require('postcss-nested');
6 | const postcssColorHexAlpha = require('postcss-color-hex-alpha');
7 | const postcssFixes = require('postcss-fixes');
8 | const postcssUrl = require('postcss-url');
9 | const autoprefixer = require('autoprefixer');
10 |
11 | const argv = parseArgs(process.argv.slice(2), {
12 | alias: { H: 'hostname', p: 'port' },
13 | string: ['H'],
14 | unknown: _parameter => false,
15 | });
16 | const port = argv.port || process.env.PORT || process.env.npm_package_config_nuxt_port || '3000';
17 | const host = argv.hostname || process.env.HOST || process.env.npm_package_config_nuxt_host || 'localhost';
18 | const postcss = [
19 | postcssImport(),
20 | postcssCustomProperties({ preserve: false }),
21 | postcssCustomMedia(),
22 | postcssNested(),
23 | postcssColorHexAlpha(),
24 | postcssFixes(),
25 | postcssUrl(),
26 | autoprefixer(),
27 | ];
28 | // 動的ルーティングのページをある程度静的に吐き出したい箇所はここにセット
29 | const routes = [
30 | // '/members/1', '/members/2', '/members/3'
31 | ];
32 |
33 | /*
34 | * meta
35 | */
36 | const title = 'Nuxt.js template - TypeScript, PostCSS';
37 | const description = 'Nuxt.js project';
38 | const metaImage = 'https://dummyimage.com/300x200/3b8070/fff.png&text=Nuxt.js+template';
39 | const baseUrl = process.env.BASE_URL || `http://${host}:${port}`;
40 | const og = [
41 | // { property: 'og:type', content: '' },
42 | // { property: 'og:image', content: '' },
43 | // { property: 'og:url', content: '' },
44 | // { property: 'og:site_name', content: '' },
45 | ];
46 | const twitter = [
47 | // { property: 'twitter:card', content: '' },
48 | // { property: 'twitter:site', content: '' },
49 | ];
50 | const meta = [
51 | { charset: 'utf-8' },
52 | { 'http-equiv': 'x-ua-compatible', content: 'ie=edge' },
53 | { name: 'viewport', content: 'width=device-width, initial-scale=1' },
54 | { hid: 'description', name: 'description', content: description },
55 | { hid: 'itempropName', itemprop: 'name', content: title },
56 | { hid: 'itempropDesc', itemprop: 'description', content: description },
57 | { hid: 'itempropImage', itemprop: 'image', content: metaImage },
58 | { property: 'og:title', content: title },
59 | { property: 'og:description', content: description },
60 | ...og,
61 | ...twitter,
62 | ];
63 |
64 | /*
65 | * sitemap
66 | */
67 | const sitemap = {
68 | path: '/sitemap.xml',
69 | hostname: baseUrl,
70 | cacheTime: 1000 * 60 * 15,
71 | generate: true, // Enable me when using nuxt generate
72 | // exclude: [],
73 | routes,
74 | };
75 |
76 | module.exports = {
77 | srcDir: 'src/',
78 | env: { baseUrl },
79 | head: { title, meta, link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }] },
80 | /*
81 | ** Customize the progress-bar color
82 | */
83 | loading: { color: '#3B8070' },
84 | /*
85 | * generate command configration
86 | */
87 | generate: { routes },
88 | /*
89 | * sitemap configuration
90 | */
91 | sitemap,
92 | /*
93 | ** Build configuration
94 | */
95 | // ここでvariablesを渡しても、postcss-custom-propertiesが発動しない
96 | css: [].map(src => ({ src, lang: 'postcss' })),
97 | build: { postcss, vendor: ['babel-polyfill'] },
98 | modules: ['@nuxtjs/axios', '@nuxtjs/sitemap', '~~/modules/typescript.js'],
99 | extractCSS: true, // 別途CSSを出力するのではなく、htmlのstyleタグに埋め込まれる
100 | axios: {},
101 | };
102 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-ts",
3 | "version": "0.0.1",
4 | "private": true,
5 | "dependencies": {
6 | "@nuxtjs/axios": "^5.0.0",
7 | "@nuxtjs/sitemap": "^0.1.1",
8 | "axios": "^0.18.0",
9 | "babel-polyfill": "^6.26.0",
10 | "libraries-frontend-framelunch": "framelunch/libraries-frontend-framelunch",
11 | "nuxt": "^1.3.0",
12 | "vue-property-decorator": "^6.0.0",
13 | "vuex-class": "^0.3.0"
14 | },
15 | "scripts": {
16 | "precommit": "lint-staged",
17 | "dev": "nuxt",
18 | "prebuild": "npm run clean",
19 | "build": "nuxt build",
20 | "start": "nuxt start",
21 | "pregenerate": "npm run clean",
22 | "generate": "nuxt generate",
23 | "clean": "rimraf dist",
24 | "guard": "run-p test:watch typecheck:watch",
25 | "test": "jest",
26 | "test:watch": "jest --watch",
27 | "test:coverage": "jest --coverage",
28 | "lint": "run-p lint:*",
29 | "lint:style": "stylelint './src/**/*.css'",
30 | "lint:script": "tslint './src/**/*.ts'",
31 | "lint:vue": "run-p lint:vue:*",
32 | "lint:vue:style": "stylelint --config .vue.stylelintrc.js './src/**/*.vue'",
33 | "fix": "prettier --write './src/**/*.{ts,js,json,css,vue}'",
34 | "typecheck": "tsc --noEmit",
35 | "typecheck:watch": "tsc --noEmit -w"
36 | },
37 | "lint-staged": {
38 | "subTaskConcurrency": 1,
39 | "linters": {
40 | "*.ts": [
41 | "prettier --write",
42 | "tslint",
43 | "git add"
44 | ],
45 | "*.css": [
46 | "prettier --write",
47 | "stylelint",
48 | "git add"
49 | ],
50 | "*.json": [
51 | "prettier --write",
52 | "git add"
53 | ],
54 | "*.vue": [
55 | "prettier --write",
56 | "stylelint --config .vue.stylelintrc.js",
57 | "git add"
58 | ]
59 | }
60 | },
61 | "browserslist": [
62 | "ie 11",
63 | "ios >= 10",
64 | "> 1% in JP",
65 | "not ie <= 10",
66 | "not chrome 49"
67 | ],
68 | "devDependencies": {
69 | "@types/jest": "^23.1.2",
70 | "@types/node": "^10.3.6",
71 | "@vue/test-utils": "^1.0.0-beta.12",
72 | "http-server": "^0.11.1",
73 | "husky": "^0.14.3",
74 | "jest": "^23.2.0",
75 | "jest-vue-preprocessor": "^1.3.1",
76 | "lint-staged": "^7.0.0",
77 | "npm-run-all": "^4.1.2",
78 | "postcss-color-hex-alpha": "^3.0.0",
79 | "postcss-custom-media": "^6.0.0",
80 | "postcss-custom-properties": "^7.0.0",
81 | "postcss-fixes": "^2.0.1",
82 | "postcss-import": "^11.1.0",
83 | "postcss-loader": "^2.1.1",
84 | "postcss-nested": "^3.0.0",
85 | "postcss-url": "^7.3.1",
86 | "prettier": "^1.11.1",
87 | "rimraf": "^2.6.2",
88 | "stylelint": "^9.1.1",
89 | "stylelint-config-framelunch": "framelunch/stylelint-config-framelunch#v0.3.0",
90 | "stylelint-processor-html": "^1.0.0",
91 | "ts-jest": "^22.4.1",
92 | "ts-loader": "^3.5.0",
93 | "tslint": "^5.9.1",
94 | "tslint-config-prettier": "^1.9.0",
95 | "tslint-plugin-prettier": "^1.3.0",
96 | "typescript": "^2.7.2",
97 | "vue-jest": "^2.1.1"
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/framelunch/nuxt-typescript-template/d4018403af9648097be8d24c16c1d190dfe97174/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/components/Card.vue:
--------------------------------------------------------------------------------
1 |
11 |
12 |
20 |
21 |
22 |
23 |
{{person.firstName}} {{person.lastName}}
24 |
![]()
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/interfaces/Person.ts:
--------------------------------------------------------------------------------
1 | export interface Person {
2 | id: number;
3 | firstName: string;
4 | lastName: string;
5 | }
6 |
7 | export type People = Person[];
8 |
9 | export interface PersonEntity {
10 | id: number;
11 | first_name: string;
12 | last_name: string;
13 | }
14 |
--------------------------------------------------------------------------------
/src/layouts/default.vue:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/middleware/README.md:
--------------------------------------------------------------------------------
1 | # MIDDLEWARE
2 |
3 | This directory contains your Application Middleware.
4 | The middleware lets you define custom function to be ran before rendering a page or a group of pages (layouts).
5 |
6 | More informations about the usage of this directory in the documentation:
7 | https://nuxtjs.org/guide/routing#middleware
8 |
9 | **This directory is not required, you can delete it if you don't want to use it.**
10 |
--------------------------------------------------------------------------------
/src/pages/about/index.spec.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | import { shallowMount } from '@vue/test-utils';
3 |
4 | import Index from './index.vue';
5 |
6 | describe('about/index', () => {
7 | it('renders props.msg', () => {
8 | const msg = 'About';
9 | const wrapper = shallowMount(Index, {
10 | propsData: { msg },
11 | });
12 |
13 | expect(wrapper.text()).toEqual(msg);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/pages/about/index.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 | About
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/pages/index.vue:
--------------------------------------------------------------------------------
1 |
41 |
42 |
58 |
59 |
60 |
61 |
62 |
63 | - アバウト
64 | - MemberTo1
65 | - MemberTo2
66 | - MemberTo3
67 | - MemberTo9999
68 | - MemberEdit1
69 | - MemberEdit2
70 | - MemberEdit3
71 | - MemberEdit9999
72 |
73 | Count: {{count.count}} | {{count100}}
74 |
75 |
76 | LocalCount: {{localCount}} | {{local100Count}}
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/src/pages/members/_id/edit.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 | Member edit {{this.$route.params.id}}
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/pages/members/_id/index.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 | Member {{this.$route.params.id}}
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/pages/members/edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 | Member edit {{this.$route.params.id}}
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/pages/members/show.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 | Member {{this.$route.params.id}}
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/static/.htaccess:
--------------------------------------------------------------------------------
1 | # Rewrite
2 | RewriteEngine On
3 | RewriteBase /
4 | # TODO: 直接覗かれたら404を返したい!これだと全殺しなのでだめ
5 | # RewriteRule ^members/edit.*$ - [R=404,L]
6 | # RewriteRule ^members/show.*$ - [R=404,L]
7 | # membersの動的URLはそれぞれのhtmlを表示する あとはvueがよしなにやってくれる
8 | RewriteRule ^members/\d+$ members/show/index.html
9 | RewriteRule ^members/\d+/edit$ members/edit/index.html
10 |
--------------------------------------------------------------------------------
/src/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/framelunch/nuxt-typescript-template/d4018403af9648097be8d24c16c1d190dfe97174/src/static/favicon.ico
--------------------------------------------------------------------------------
/src/static/robots.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/framelunch/nuxt-typescript-template/d4018403af9648097be8d24c16c1d190dfe97174/src/static/robots.txt
--------------------------------------------------------------------------------
/src/store/count.ts:
--------------------------------------------------------------------------------
1 | export interface State {
2 | count: number;
3 | }
4 |
5 | export const state = () => ({ count: 0 } as State);
6 |
7 | /*
8 | * getter stateを規則的に加工したいときはこれでOK
9 | * @Getter('count/count100') count100: number; で{{count100}}でとれるようになる
10 | */
11 | export const getters = {
12 | count100(currentState: State) {
13 | return currentState.count * 100;
14 | },
15 | };
16 |
17 | /*
18 | * mutation ここでstateを変更する。複雑なことはなるべくactionでやる
19 | * こいつを直接呼ぶことはあんまないっていうか、多分アンチパターン
20 | */
21 | export const mutations = {
22 | addCount(currentState: State, add: number) {
23 | currentState.count += add;
24 | },
25 | };
26 |
27 | /*
28 | * action stateに反映したい値を取得・作成する。非同期処理もここ。
29 | * @Action('count/countup') onCountUpClick: void;
30 | * @Action('count/countdown') onCountDownClick: void;
31 | * で@click="onCountDownClick" みたいな
32 | */
33 | export const actions = {
34 | countup({ commit }: IncludeCommitObject) {
35 | commit('addCount', 1);
36 | },
37 | countdown({ commit }: IncludeCommitObject) {
38 | commit('addCount', -1);
39 | },
40 | };
41 |
42 | /*
43 | * TODO 強引
44 | */
45 | interface IncludeCommitObject {
46 | commit(action: string, value: any): void;
47 | }
48 |
--------------------------------------------------------------------------------
/src/store/index.ts:
--------------------------------------------------------------------------------
1 | import { AxiosRequestConfig } from 'axios';
2 |
3 | import { People, Person, PersonEntity } from '../interfaces/Person';
4 |
5 | export interface State {
6 | people: People;
7 | }
8 |
9 | export const state = () => ({ people: [] } as State);
10 |
11 | /*
12 | * mutation ここでstateを変更する。複雑なことはなるべくactionでやる
13 | */
14 | export const mutations = {
15 | setPeople(currentState: State, people: People) {
16 | currentState.people = people;
17 | },
18 | };
19 |
20 | /*
21 | * action stateに反映したい値を取得・作成する。非同期処理もここ。
22 | * 各componentからはこれを呼ぶ @Action('ACTION_NAME') onButtonClick: void; みたいな。
23 | */
24 | export const actions = {
25 | async nuxtServerInit({ commit }: IncludeCommitObject, { app, isStatic, isDev, isHMR, route }: NuxtApp) {
26 | if (isStatic || route.name !== 'index') {
27 | return;
28 | }
29 |
30 | const people = await app.$axios.$get('./random-data.json');
31 | commit(
32 | 'setPeople',
33 | people.slice(0, 20).map(
34 | person =>
35 | ({
36 | id: person.id,
37 | firstName: person.first_name,
38 | lastName: person.last_name,
39 | } as Person),
40 | ),
41 | );
42 | },
43 | };
44 |
45 | /*
46 | * TODO 強引
47 | */
48 | interface IncludeCommitObject {
49 | commit(action: string, value: any): void;
50 | }
51 |
52 | interface NuxtApp {
53 | app: {
54 | $axios: {
55 | $get(url: string, config?: AxiosRequestConfig): Promise;
56 | };
57 | };
58 | route: { name: string };
59 | isStatic: boolean;
60 | isDev: boolean;
61 | isHMR: boolean;
62 | }
63 |
--------------------------------------------------------------------------------
/src/styles/keyframes.css:
--------------------------------------------------------------------------------
1 | @import "libraries-frontend-framelunch/css/_keyframes.css";
2 |
--------------------------------------------------------------------------------
/src/styles/reset.css:
--------------------------------------------------------------------------------
1 | @import "libraries-frontend-framelunch/css/_reset.css";
2 |
--------------------------------------------------------------------------------
/src/styles/variables.css:
--------------------------------------------------------------------------------
1 | @import "libraries-frontend-framelunch/css/_variables.css";
2 |
3 | :root {
4 | --color-text: #f0f0f0;
5 | }
6 |
--------------------------------------------------------------------------------
/src/types/process.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace NodeJS {
2 | interface Process {
3 | client: boolean;
4 | server: boolean;
5 | browser: boolean;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/types/vue-shims.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.vue' {
2 | import Vue from 'vue';
3 |
4 | export default Vue;
5 | }
6 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "es2015",
5 | "lib": ["dom", "es2015", "es2017"],
6 | "allowJs": true,
7 | "sourceMap": true,
8 | "removeComments": true,
9 | "strict": true,
10 | "noImplicitAny": true,
11 | "strictNullChecks": true,
12 | "strictFunctionTypes": true,
13 | "strictPropertyInitialization": false,
14 | "noImplicitThis": true,
15 | "moduleResolution": "node",
16 | "baseUrl": ".",
17 | "paths": {
18 | "~/*": ["./src/*"]
19 | },
20 | "allowSyntheticDefaultImports": true,
21 | "experimentalDecorators": true,
22 | "emitDecoratorMetadata": true
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": ["tslint-plugin-prettier"],
3 | "defaultSeverity": "error",
4 | "extends": [
5 | "tslint:recommended", // https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts
6 | "tslint-config-prettier"
7 | ],
8 | "rules": {
9 | // コンソール禁止 無効化 babel挟むとかしてどっかではずせばよい
10 | "no-console": [false],
11 | // 文字列はシングルクォート JSXはダブル テンプレがらみやエスケープ絡みは適当
12 | "quotemark": [true, "single", "jsx-double", "avoid-template", "avoid-escape"],
13 | // オブジェクトのキーをa-z順 めんどくさすぎるので無効化
14 | "object-literal-sort-keys": [false],
15 | // import順をa-z順 めんどくさすぎるので無効化
16 | "ordered-imports": [false],
17 | // interfaceはIはじまりで命名 無効化 Microsoftのクセが有る人にはそっちのほうがいいんだけど。
18 | "interface-name": [false],
19 | // アローファンクションの引数をカッコで括る 有効 ただし引数が1つだけの場合は無効化
20 | "arrow-parens": [true, "ban-single-arg-parens"],
21 | // クラスのアクセス修飾子強制 JSに寄せるため無効化
22 | "member-access": [false],
23 | // クラスのメンバをa-z順 めんどくさすぎるので無効化
24 | "member-ordering": [false],
25 | // 変数名予約語禁止、lowerCase or UPPER_CASE、アンスコ始まりOK
26 | "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"],
27 | // namespace禁止 ただし型定義の際には許可する
28 | "no-namespace": [true, "allow-declarations"],
29 | // ifやwhileなど{}が必要な構文は必須 ただし同一行に書いちゃう場合はスルー
30 | "curly": [true, "ignore-same-line"],
31 |
32 | /*
33 | * enable prettier
34 | */
35 | "prettier": true
36 | }
37 | }
38 |
--------------------------------------------------------------------------------